ICM profile hacker.

Version 1.11 released 21-Nov-2002

Project started around April 2002

Project continued at http://nerdipedia.com/tiki-index.php?page=colour+management

Do you dream in color? After the two weeks of my "spare" time spent writing a ICM color profile editing program I dream in color a lot.

There are rubix cubes on steroids with letters L A B on the sides.

And some with RGB and others XYZ.


Seriously now what is this craziness about � it is about making my printer print colors I like when using a third party archival ink.

If you are new to this I have some bad news.


  1. Not all perceivable colors can be displayed on a computer.

  2. Not all the colors which can be displayed on a computer can be printed on a color printer.

  3. Not all colors which can be printed on a dye based printer can be printed on a pigment based (inkjet) printer.

  4. Different combinations of types of ink and paper produce radically different colors with identical printer settings.

We can't do much about the first three points but we can try to manage the available colors set to produce nice prints.

Now before I get into the nitty gritty I'm going to have a little whine and I'm sure I'm not alone here.

I want to whine about three things

  1. I think the average consumer is not informed about total cost of ownership of printers.

  2. Users are ripped of buying ink cartridges and at least one manufacture (epson) tries to prevent users from using 3'rd party ink by chipping their cartridges.

  3. Users are rarely informed what sort of life they can expect out of their prints.

The sad thing is espon make really good printers - but unless they stop this non-sense my next printer will probably be a canon.
My personal example is I bought an epson stylus 760. It produces amazing results but the price of ink cartridges is outrageous and refilling doesn't work too well at all. And to top it off the 3'rd party ink refills I used have an extremely short life if exposed to light (and fumes?). My anwser to all this was to build a CIS (continuous inking system) and buying an archival ink set � (generations-2 from media-street). I built the CIS because the price quoted for a commercial system was ridiculous. You can see my CIS in the photography area of my home page (I won't link it because it may move). Unfortunately the new ink set make terrible looking prints with weak cold yellow and reds. It isn't just a matter of adding more yellow because that wrecks the other colors. You need to adjust some parts of the pallet one way and others differently. This is something ICM color management can do. Custom ICM profiles can be bought and if your luck you might find a free profile close enough for your needs (I didn't). Software to create profile can be bought but I have no idea how good they are. I am not aware of any free-ware apart from mine.

Being a hacker (not cracker) type with the motto "They're only numbers � how hard can it be" - I dived in to writing my own.

If you at all serious about this you need to look at http://www.color.org/ where you can find the specs for the ICM files. There is also some handy stuff athttp://www.littlecms.com/. At http://www.logicol.net/color_calc.html you can find a color space calculator and code examples to swap between color spaces.

I won't explain ICM in any great detail but the gist is to have a universal way for programs to communicate color information and this is not RGB and a way to translate the colors. The common or PCS (profile connected space) is usually CIE LAB. The profile usually contain a number of CLUTs (color look up tables) but my program only deals with two with the main aim of modifying one of them. This CLUT is called B2A0 (or BtoA0) it has the data for converting from PCS to the device � ie the printer. There can be multiple B2A cluts but I ignore them. I can also look at the A2B CLUT but this is mainly educational. In the beginning I thought the A2B clut may be used to convert the input to PCS but this does not appear to be the case.
Each CLUT has a 3*3 matrix, several lookup tables, the for LAB the matrix does nothing and the input and output table are usually straight line functions which also do nothing. That leaves the CLUT work horse which is a three dimensional lookup table (I'm only talking about 3 channel (RGB) conversion, more channels could mean more dimensions) . In an our case the A2B table the 3D CLUT the cells (elements) are addressed using R, G and B and the cells contain three values L, A and B. The B2A 3D CLUT is the other way around - the cells are addressed using L, A and B and the cells contain RGB values. The tables don't contain all possible colors so the ICM software interpolates.

I will only discuss the later table.
The L is for luminance (ie lightness) and A and B are the chroma (color). This is an image of one layer of the 3D CLUT. It is layer 16 of a 31*31*31 array. The 16 corresponds to 'L' and the A and B are the horizontal and vertical axis (possibly upside down, back to front or otherwise mixed up) but anyway A and B select the color. You can visualize the table as a cube made by stacking layers like this 31 deep with the bottom dark and the top light but the colors in the same positions. You will also have a neutral column in the centre � black at the bottom and white at the top.

The previous image is from one the CLUTs generated by my program this one is from a standard epson profile. Note there are 2 missing cells. The colors are less saturated because the OEM inks are brighter. By modifying the table we can get fairly good colors from pigment inks until we reach the limitations of the ink. I also warm up the cold yellows by adding some red to the "yellow" cells.

This is the main screen. It allow profiles and images to be loaded and conversions thru various stages can be visually checked. The image on the right may look terrible but this is what the ICM sends the printer to get an image like the one on the left (my program does not print anything).

This is the fun part � building a new 3D CLUT.
Over all saturation � this adjusts the brightness of the colors. A saturation of zero would result in a monochrome image (if I didn't crash). Archival inks have less saturation than dyes so this is useful to compensate. This control isn't totally necessary because adjusting all the individual controls can achieve the same result (and turning them to zero to generate a BW profile does not crash the program).

Individual saturation � no prizes for guessing this lets us control the brightness of individual colors.

Gamma � This is hard to explain, it affects darkness and contrast � play with it.

Trim neutral lets you make the grays gray. If your prints are blue you adjust these controls to make the patch yellower � we could reverse this in future versions.

Load and Save setting let us save and reload the numbers in the spin-boxes as text based ini files.

Lum only adjusts the sample color strip luminance on the screen it has no affect on the generated CLUT.

Color shift is the used to compensate for impure ink color. The generations ink has a very cold yellow, (tend towards green) while the OEM ink is very warm (tends towards orange). If we put a positive number in the left hand 'shift' spin box the CLUT will have some red added to the yellow bits.


This program fills the gap between the inadequate standard colors controls that can be used with the epson driver and commercial profile generators � many of which use scanners and custom targets to attempt automatic calibration. It is really just for epsons because although they use CYMK inks they behave as RGB devices. I wrote it for my own use and it is not really finished. I have many other projects I want to work on so this is it. If someone (delphi guru) wants to take it further talk to me. There are a few areas that need work (apart from commenting the code). The program can not generate a profile from scratch - every epson owner should have ICM profiles they can hack but it would be nice to not need them. Currently the white point is hard coded and the profile white-point is not used. It would also be good to make the CLUT ini files a bit fancier - mainly to make future expansion easier. I have found the controls adequate but extra controls may be required for some printers. For example we might want to control the luminance on individual colors.

You can download the zipped for free. All the standard disclaimers apply. It doesn't contain trojans or spy-ware but it probably has bugs, it will not be able the edit all profiles but the few I've tried have worked. If you find a bug let know, if its simple I'll fix it but no promises.

While using the program (v1.1) for the first time in 6 month I found it was broken. The �individual luminance� setting weren't used for table generation.
Fixed in V1.2

My printer started printing the highlights pinkish/blue. I've added independent control for shadow and highlight trimming in V1.3. This is pretty crude but made a noticable improvement.

October 2008 - Project continued at http://nerdipedia.com/tiki-index.php?page=colour+management


Have fun, Eddie,

Was this Interesting? If so.
Check out the rest of the site here.

Or the photography section here.

Escati Free Counter
You are Visitor No:

View Counter Stats