The RGB values of a pixel can be determined by the command:
Code: Select all
convert example.png -format "%[pixel:s.p{10,10}]" info:
Thanks in advance for your help.
Code: Select all
convert example.png -format "%[pixel:s.p{10,10}]" info:
Color ranges can be a bit ambiguous. The best interpretation that I can give is to find all pixels that are red=0, green between 0 and 64, and blue between 0 and 255 (all blue values). So one way to do that is to create a mask for each channel that is white for each range you want and black elsewhere. For a range of gray values in a channel, you can use a combination of -black-threshold and -white-threshold to get your the range. Then -compose multiply -composite the masks to get one mask. Then get the mean of the mask (in range 0-1, via -format "%[fx:mean]" info:) and multiply that by the total pixels in the image.cv_scientist wrote:Dear ImageMagick Users,
The RGB values of a pixel can be determined by the command:This works fine, but how can I determine how many pixels have RGB values within a certain range (for example [0,0,0] to [0,64,255])?Code: Select all
convert example.png -format "%[pixel:s.p{10,10}]" info:
Thanks in advance for your help.