Reverse-Engineering of the Adobe Color File Format

Introduction

As part of Duo's current mobile game development, we found it would be useful to restrict Photoshop to a 4096-colour palette, which closely resembled that of the Nokia phones we were targeting. The restricting itself can be done by using Photoshop's "Swatches", a group of which can be imported from an Adobe Color (.aco) file.

I couldn't find any useful information about the file format on the web, so ended up reverse-engineering the format from a few example files I was able to make up. Now I've written this page in an effort to help out anyone else who might find it useful.

Description of the file

The canonical ACO file is made up from the following elements: All the elements within the file are made from 16-bit integers.

The first section of the file, section 1, contains the RGB information for all the swatches. Its general form is:

The second section of the file, section 2, follows right after, and contains the same RGB information, together with the name of the colour. Its general form is:

Example File

This is an example file I made with Photoshop 7. The first colour is red (255,0,0) and the second colour's green (0,255,0). The names of the swatches are "Swatch 1" and "Swatch 2", respectively.

00000000 0001 0002 0000 ffff 0000 0000 0000 0000 |................|
00000010 0000 ffff 0000 0000 0002 0002 0000 ffff |................|
00000020 0000 0000 0000 0000 0009 0053 0077 0061 |...........S.w.a|
00000030 0074 0063 0068 0020 0031 0000 0000 0000 |.t.c.h. .1......|
00000040 ffff 0000 0000 0000 0009 0053 0077 0061 |...........S.w.a|
00000050 0074 0063 0068 0020 0032 0000           |.t.c.h. .2..|

4096-Colour Palette Generator Code

Here's the C code I wrote to generate the 4096-colour palette we were after. It was a quick hack, as it's the results that were important to us. The code outputs the binary data to STDOUT, so you'll probably want to redirect it to a file.

Notes

  1. It's possible that the repeated colour components (e.g. RRRR) are pre- and post- gamma correction by Photoshop. In files I'd exported, the first byte was always the colour I'd set, and the second was often a lower value.
  2. Larry Tesler has followed up this work and done a more thorough job of it, to boot. See his Adobe Photoshop Color File Format page.

Chris Berry 2004-09-01