To be precise, I want to tell how much of my image contains #ECAE01 for a script I'm writing.
Any and all help much appreciated!
![Smile :)](./images/smilies/icon_smile.gif)
alexp2_ad wrote:Is it possible to detect the amount of a specific color (in this case, yellow) as a percentage or number of pixels in an image?
To be precise, I want to tell how much of my image contains #ECAE01 for a script I'm writing.
Any and all help much appreciated!
alexp2_ad wrote:Thanks for your help, I'm just having a play around with your commands, I think I see how they all work, but I am having one problem: they don't seem to be running properly on the command line - specifically whatever is after +opaque generates a message along the lines of "convert: unable to open image `none': No such file or directory." - this is true if I try precise rgba colors or just any color names (like none) - I can't see why it thinks this should be a file and not a color. Am I doing something wrong?
Thanks again!
EDIT: If it's relevant info I'm using the bash shell with Mac OS X 10.5 and ImageMagick 6.4.1
Code: Select all
convert colorwheel.png -alpha set \
-fuzz 25% -transparent yellow \
-verbose info:
or 5.1% of the image has colors simular to yellow!...
alpha:
min: 0 (0)
max: 65535 (1)
mean: 3379.95 (0.0515747)
standard deviation: 14494.2 (0.221167)
...