Question:
- Given an image in PNG format, what is the simplest way to programmatically obtain the number of colors used in the image?
Constraints:
- The solution will be integreted into a shell script running under Linux, so any solution that fits in such an environment will do.
- Please note that the "color capacity of the image file" does not necessarily correspond to "colors used". Example: In an image file with a theoretical color capacity of 256 colors only say 7 colors might be in actual use. I want to obtain the number of colors actually used.