Page 1 of 1

read pixel value

Posted: 2013-08-23T04:41:33-07:00
by waggs
Is it possible to read the pixel value at any particular x,y pixel coordinate using IM?
If so, how?

cheers
waggs

ImageMagick 6.8.6-6 2013-08-08 Q16
iMac

Re: read pixel value

Posted: 2013-08-23T06:25:41-07:00
by snibgo
For example, to read the pixel from the in-built rose image at coordinate (40,50):

Code: Select all

convert rose: -format "%[pixel:p{40,50}]" info:
The result is: srgb(80,78,52)

Re: read pixel value

Posted: 2013-08-23T10:29:10-07:00
by fmw42
see http://www.imagemagick.org/Usage/transform/#fx_escapes for more examples and discussion

Re: read pixel value

Posted: 2013-08-23T16:12:43-07:00
by waggs
Thanks both - does what I want.

Re: read pixel value

Posted: 2013-09-29T23:50:58-07:00
by anthony
If you are wanting a lot of pixels and not just one, then outputing the image as a "txt:" file will be better.