Color Calibration Rabbit Hole

An interesting journey into the world of color calibration and associated open source tools.

updated: 2021-02-08 | created: 2021-01-31 | topic: computer | tag: color,calibration | author: Jason Lenz

I recently fell down the rabbit hole of color calibration for digital devices. It started out simple enough. I wanted to archive some family photos by scanning them in on my home scanner (an HP OfficeJet Pro 6978). I remembered hearing vaguely in the past about the possibility of adjusting or correcting the color of scanned documents to correct for any offset in the hardware. Coming from an engineering background I knew that I needed a known good physical color sample (aka a standard) to be able to compare to to see how much offset existed in my scanner if any.

Finding a Color Standard

So I proceeded to look on eBay to see if any color calibration standards were available for sale. They were definitely available, however I was initially quite surprised to find out how expensive these were (roughly 70$ to $400). After all, I thought it’s just a piece of plastic or paper with various colors on it. After trying a number of search terms I landed on “color correction card” and then found some options that were much more palatable ($17 to $30). So I ordered the $17 version since I was just trying to get in the ballpark and am not doing this professionally for a living. Below is an image of the color correction card that I purchased.


Although this card ended up working well for me, it wasn’t the best option out there. In particular if you are planning to purchase a color calibration card I would recommend getting one from Wolf Faust at He carries a full range of color calibration targets for different applications. The “RF” target is an economical scanner target that he sells for $10 or 10 Euro. Shipping is an additional $10 to ship to the US, or 5 Euro if you live in Europe. His RF target has many more color patches than the $17 version that I bought, is higher quality, and in addition comes with a digital color calibration file that is specific to the calibration target you receive. Lastly it comes recommended by the Argyll CMS author (see the next section below).

Open Source Color Calibration Software

Researching available software and the actual process of doing the color correction is the part that I should have started with first. It took a fair amount of time and searching down false trails, but I eventually found some posts from others who had done this and landed on the Argyll CMS website. The website itself looks vintage and immediately dives into technical terms such as ICC, RGB, CMYK, gamut, etc., but make no mistake the author Graeme Gill knows his stuff and has written some very useful open source command line utilities for this purpose.

It also became very apparent that there’s a whole world dedicated to this involving not just scanners, but printers, cameras, displays, colorimeters, etc. The professional graphics artists and photographers of the world probably live and breath this stuff daily but it’s definitely a bit overwhelming for the casual user.

Steps to Calibrate

The Argyll CMS instructions at cover how to color calibrate a scanner, but it took a lot of reading and consulting other sites before I was able to decipher things and come up with the specific steps below. Hopefully this will save others some time. Note that these instructions focus on command line (CLI) tools which was my goal since I wanted to automate this from the unix shell. If you need a graphical interface the instructions below may not help you much.

You will need to make sure ArgyllCMS is installed to have access to the scanin and colprof command line tools. In addition you will also need ImageMagick which is an open source swiss army knife for image manipulation. The “convert” tool from ImageMagick in particular is used below.

Steps to generate the color calibration file for your scanner:

  1. Scan the Target. Set up your scanner exactly the way you plan to use it going forward and scan in the color target. For our purposes we will call the scanned file “color_chart.png”.

  2. Convert to TIFF. ArgyllCMS likes input files to be in the TIFF image file format. You can use the convert tool as follows to do this:

    $ convert color_chart.png color_chart.tif

  3. Generate TI3 File. Execute the scanin tool as follows to create a “ti3” file. The ti3 file is an intermediate file that records the colors your scanner generated for the color calibration target as well as the actual “real” colors that are on the color target. You will need three files as input for the scanin command below. The first is your tiff file containing the scanned image of the color target, the second is a “cht” file which describes how many color patches are on your card and where they are on the card. The third file is a “cie” file which contains information on what the “real” reference colors are on the color calibration target. The cht and cie files are specific to the color target that you use. In my case the 24 patch color target that I purchased is called a “Macbeth ColorChecker chart”, and ArgyllCMS had the associated “ColorChecker.cht” and “ColorChecker.cie” files available in the installation folder at /usr/share/argyllcms.

    $ scanin -dipn -v color_chart.tif ColorChecker.cht ColorChecker.cie

    After running the command above you should have a “color_chart.ti3” file generated.

    Note: The -dipn option generates a “diag.tif” file which can be viewed to confirm that the scanin tool detected the correct color patches on your color target (see example picture below).


    Also note that if you receive a cie file from your color target provider as in the case from Wolf Faust the file may end in .txt or some other extension. It seems the .cie file extension is not universal.

  4. Generate ICC File. Execute the colprof tool to convert your “ti3” file to an “icc” file. The -D option below is useful to embed a descriptive comment in your icc file describing the device that the icc file is for. Note that this reads in your ti3 file generated above but you should not include the ti3 file extension when executing colprof (go figure).

    $ colprof -v -D"OfficeJet Pro 6978" -qm -as color_chart

  5. Name the ICC File. As the last step I recommend renaming the icc file to match the hardware that it represents. In my case I named the file “hp6978.icc” to match the scanner model I’m using.

Steps to Adjust / Correct Image Colors

Now that you’ve gone through the work to obtain this ICC file you can use this same file over and over for any new scans you do to correct the color palette. You just need to make sure you don’t adjust any scanner hardware settings that affect color otherwise you will need to regenerate your ICC file to match the new scanner settings.

The Imagemagick convert tool can be used to apply your new icc color profile to an image that you’ve scanned. To do this properly you should also have an sRGB color profile file. This can be obtained from the same Argyll CMS installation folder mentioned above which on my computer is at /usr/share/argyllcms. Note that the color profile file there is named “sRGB.icm”. the .icm and .icc file extensions are both color profile file extensions and can be essentially used interchangeably.

$ convert infile.png +profile '*' -profile hp6978.icc -profile sRGB.icm outfile.png

It’s helpful to know that the icc color profile is typically added into the image file as metadata. Sometimes image scanning software automatically adds the sRGB color profile which is a standardized default color space for images that contain no color space info. The (+profile ‘*’) command above wipes out any existing default color profile that may have been added, and then the remaining two -profile commands set the profile to the calibrated one, and then changes it yet again to the standard sRGB color profile.

You may be wondering why change it back to sRGB with the last -profile command. The reason is that many common user applications that display or print images aren’t set up to accomodate custom icc color profiles. These applications for the most part assume the image is using the sRGB color profile.

Color conversion of the image contents only happens when converting from one color profile to another. So if your image file has no existing color profile and you add the calibrated color profile you won’t see a difference when viewing the image in most viewing software. Only when you add the last “-profile sRGB.icm” statement does the imagemagick convert command do the color conversion on the image contents.

If you are using software, display, or printers that properly recognize the icc color profile then you can leave off the last step to convert the color profile to sRGB. This scenario usually only applies to professional graphics artists and photographers though.

The Results

I was very interested to see if the color correction on scans coming from my HP 6978 scanner would be noticeable after using this process. In my case I believe it made a significant improvement in the final colors. Below is an animated image showing the impact of the color correction on the scanned color target image itself. The colors on the corrected image noticeably “pop” and are much more accurate compared to the original scan in my humble opinion.

Scanned vs Corrected


The links below were helpful for me while learning about this process and may be helpful to others as well.