Calculating colors from an image file

Is there a program in the market that are able to calculate all unique colors in an image file? ColorThink Pro does not do it correctly. I tried with Bruce Linblooms 16 million RGB file and it only showed 250 000 colors as a result. I can understand if ColorThink will not show all as the column with all number will be too large, but I wish I could see the number without using the color list, perhaps a future function?. Is there another way? I want to try to see how much the quantization error is when converting an 8 bit RGB file to Lab and then back to RGB. ColorThink is not able to show this.


Surprisingly, the relatively humble program Paint Shop Pro can count the number of unique colours in a layer in an RGB file. I’ve still got an old copy, version 6.02, but this correctly counts the number of colours in Bruce Lindbloom’s test TIF image as 16,777,216 (‘Colors->Count Colors Used’ menu item).

After assigning sRGB in Photoshop CS, converting to Lab using Relative Colorimetric (no BPC, no dithering) then back to sRGB (same params) PSP reports the number of unique colours as 2,186,434, which is not exactly the same as Bruce’s figure of 2,186,238 but pretty close. If you use BPC and dithering, the number becomes 5,130,684. Dithering is filling in some of the holes.

So you could try using PS for the colour space conversions, and PSP simply for counting the colours .



Since you bring it up, let me explain a bit about what ColorThink Pro is doing in the “Extract Unique Colors” function.

First of all, we should remember that individual RGB values do not necessarily equate to being distinguishable colors. Having 16 million color combinations does not mean that each of those individual colors will be perceptible by the human eye. For more on this, see Color Management Myth number 28 from one of our newsletters:

When you choose to extract unique colors in an image in the CTP worksheet, CTP will convert the image to Lab space, and then round the result with a somewhat coarse rounding. This is done on purpose to optimize these colors for graphing. You will probably get fewer unique colors than another method would give you.

It’s nice to hear what features you want to see in this software. If this function does not do what you need, go ahead and fill out a feature request ticket, and we’ll look into putting this into a future version of ColorThink. Make suggestions, like “install a checkbox for ‘Do not constrain unique colors’” or something like that.