kuzat / screenshot-node Goto Github PK
View Code? Open in Web Editor NEWTakes a screenshot of selected area and saves it to disk
License: MIT License
Takes a screenshot of selected area and saves it to disk
License: MIT License
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);
}
Is there a way to save the image as a buffer in a variable and not in disk?
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.
I have noticed that we can save the images in only png format. Can other formats be supported?
There is no multi monitor support as of now. It should probably be implemented.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.