Skip to main content
Participating Frequently
November 23, 2020
Question

Custom indexed colors from a script

  • November 23, 2020
  • 2 replies
  • 837 views

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?

2 replies

Inspiring
December 1, 2020

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.

 

Stephen Marsh
Community Expert
Community Expert
November 24, 2020

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://graphicdesign.stackexchange.com/questions/90809/export-adobe-photoshop-color-table-act-file-as-csv-file

https://community.adobe.com/t5/photoshop/how-do-i-export-the-color-table-act-file-using-a-script/td-p/11081410

https://www.lifewire.com/act-file-2619481

https://github.com/zenozeng/act.js/