Custom indexed colors from a script
Copy link to clipboard
Copied
Wondering if anyone has advise on converting a logo bitmap file to indexed colors (RGB) that have been extracted beforehand in an image analyzer. I'm looking to use a script to convert it to specific colors but am having trouble understanding what the color table uses to order the colors. I've tried hue, popularity luminance and they all give me inconsistent image results. Any idea what the method to ordering the colors?
 
 
Explore related tutorials & articles
Copy link to clipboard
Copied
I would imagine that the most common method is to reduce the existing colours in the image using the built-in indexed colour algorithms in Photoshop (perceptual, selective, adaptive etc). There is another option, which is to use a pre-defined "Adobe Color Table" or .ACT file.
Knowing this, a Google search kicked up many hits, here are just a few:
https://www.lifewire.com/act-file-2619481
https://github.com/zenozeng/act.js/
Copy link to clipboard
Copied
This isn't so straight-forward in Photoshop scripting, but the format is simple enough.
The file fomat can be found here. Each colour is started as a hexdecimal colour with zeroes as padding ending up with the number of colours and transparancy index.
As you see from the image of a text file (Sublime Text) editor the first (highlighted) colour is #000000. Followed by #204020, #202020, #ff00ff etc
There doesn't seem to be any rhyme or reason to the ordering of the colours. Sometimes it's light to dark, other apparerntly random.
a good start the the second link Stephen mentioned, as that basically writes out the act file from the PSD (the long way round - you'll find out) But that's enough to get you started.

