Coder Social home page Coder Social logo

kuzat / screenshot-node Goto Github PK

View Code? Open in Web Editor NEW
23.0 23.0 8.0 23 KB

Takes a screenshot of selected area and saves it to disk

License: MIT License

Python 11.50% JavaScript 2.85% C 24.74% C++ 51.27% Objective-C++ 9.64%
cross-platform linux macos screenshot screenshot-node windows

screenshot-node's People

Contributors

gvmani avatar kuzat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

screenshot-node's Issues

Memory leak in OSX

I think there's a memory leak on OSX; each screenshot's image data is allocated in memory but not freed

In prtscn_osx.mm

void getScreen(const int x, const int y, int W, int H, const char* path) {
        ...
  CGImageRef image_ref = CGDisplayCreateImageForRect(CGMainDisplayID(), rect);
  CGImageWriteToFile(image_ref, [NSString stringWithUTF8String:path]);
}

The image reference should be freed after its no longer needed.
Referring to the developer docs
https://developer.apple.com/documentation/coregraphics/1454595-cgdisplaycreateimageforrect

The caller is responsible for releasing the image created by calling CGImageRelease.

It should be

void getScreen(const int x, const int y, int W, int H, const char* path) {
  ...
  CGImageRef image_ref = CGDisplayCreateImageForRect(CGMainDisplayID(), rect);
  CGImageWriteToFile(image_ref, [NSString stringWithUTF8String:path]);
  CGImageRelease(image_ref);
}

nw-gyp rebuild fail

I have to compile manually because I work with nwjs
nw-gyp rebuild --target=0.42.5 --arch=ia32
https://prnt.sc/q1ze7n

I think, your code is compatible for nodejs 4.x, can you code to 10.x? But I am not sure about that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.