imagemagick

ImageMagick get pixel color by x y coordinates


I have this 30x20 image which is 10x increased in size here:

enter image description here

I need to get the color of the pixel with the coordinates x 19 and y 14 which in this case is red

I changed all kind of values in this code:

-crop "1x1+0+%[fx:h-7]+0" -format "%[hex:u.p{0,0}]\n" info:

but only get the blue pixel


Solution

  • If you want pixel at (19,14), you need:

    magick image.png -format "%[hex:u.p{19,14}]\n" info:
    

    Or:

    magick image.png -crop 1x1+19+14 -format "%[hex:u.p{0,0}]\n" info: