gm icon indicating copy to clipboard operation
gm copied to clipboard

Get pixel details

Open kirkstrobeck opened this issue 10 years ago • 5 comments

How would you go about getting the color of a specific XY coord of a pixel?

kirkstrobeck avatar Jan 16 '15 19:01 kirkstrobeck

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.

prafiles avatar Feb 20 '15 08:02 prafiles

+1. Need to trim borders from images. Trying to figure out how.

lgomez avatar Jul 04 '15 20:07 lgomez

Just noticed there's a trim method. gonna try that one. Have you tried it?

lgomez avatar Jul 04 '15 20:07 lgomez

Any solution to this? :thought_balloon:

IonicaBizau avatar Feb 26 '16 05:02 IonicaBizau

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.

TuureKaunisto avatar Feb 18 '19 13:02 TuureKaunisto