gm
gm copied to clipboard
Get pixel details
How would you go about getting the color of a specific XY coord of a pixel?
Yes i too am considering using gm in our production servers. However a part of the problem requires to read specific pixels (bordering pixels) to consider if the image needs trimming at all.
+1. Need to trim borders from images. Trying to figure out how.
Just noticed there's a trim method. gonna try that one. Have you tried it?
Any solution to this? :thought_balloon:
I managed to get the pixel data using this method:
img.out('-crop').out('1x1+25+30').out('-depth').out('8');
img.toBuffer('txt', (err, buffer) => {
console.log(buffer.toString());
}
This seems to be rather slow but since I only need to check couple of pixels it's fine for my use case. A nicer and faster way of doing this would be great.