Count number of unique colors minus transparent one
Posted: 2010-05-04T03:26:29-07:00
Hello,
I have a (perhaps) simple question, but i wasn't able to find a solution yet.
In a script i made, to get the number of unique colors of an image, i'm currently using this command:
For a pure B/W image with transparent white, the command correctly returns 2.
What i'd need to do is to obtains the number of unique and PRINTABLE colors. In simple terms, i'd need to decrease the returned value by 1 if the image has a fully transparent color in it.
That's it: for a clipart with 102 counted colors, i'd need to obtain 101 if any of those colors is fully transparent.
PRoblem is this has to be done automatically by the script.
Is there anything in ImageMagick to determine if an image is using any fully transparent colors? Or eventually the reverse, IE if all used colors are opaque?
Thanks in advance.
I have a (perhaps) simple question, but i wasn't able to find a solution yet.
In a script i made, to get the number of unique colors of an image, i'm currently using this command:
Code: Select all
identify +antialias -format "%k" myfile.png
What i'd need to do is to obtains the number of unique and PRINTABLE colors. In simple terms, i'd need to decrease the returned value by 1 if the image has a fully transparent color in it.
That's it: for a clipart with 102 counted colors, i'd need to obtain 101 if any of those colors is fully transparent.
PRoblem is this has to be done automatically by the script.
Is there anything in ImageMagick to determine if an image is using any fully transparent colors? Or eventually the reverse, IE if all used colors are opaque?
Thanks in advance.