Color management on Linux

In Living Color

Article from Issue 178/2015

Get a grasp of color management basics and put your knowledge to practical use.

The purpose of color management is to produce consistent color output across different devices. This definition might sound simple enough, but understanding the mechanics of color management and implementing a color-managed workflow can be a rather complex and confusing affair at times. This article can help you to get an understanding of color management fundamentals and set up a color-managed environment using open source Linux tools.

Color Management Distilled

The need for color management arises from the fundamental problem of color reproduction: a formal representation of a given color (e.g., numeric value of the color in a specific color model) doesn't necessarily produce the same color on different devices for a wide variety of factors. Thus, the primary goal of color management is to achieve a consistent color reproduction across devices. So, for example, a photo taken by a color-managed camera should look the same on a color-managed computer screen.

In a color-managed workflow, each device (e.g., a digital camera and LCD display) has its own color profile that characterizes the color response of that particular device. Each color profile describes these colors relative to a standardized set of reference colors. Color-managed software then uses these standardized profiles to translate color from one device to another. This is usually performed by a color management module [1].

Color profiles are closely related to the concept of color space. A color space is a defined range of colors, or as Thom Hogan puts it, "a Color Space defines what is possible" [2]. Put another way, a color space determines the color capabilities of a specific device or application. Although a color space contains color definitions, a color profile describes the color input or output of a device.

Several color spaces have been established, so which one should you choose? A detailed answer to that question deserves a separate discussion, but the simple truth is that the sRGB color space is adequate for general use. Developed specifically for the Internet, sRGB is smaller compared with other color spaces (most notably Adobe RGB), but it's widely supported by manufacturers and developers, and it's a default color space on virtually any device and application that supports color management. digiKam, for example, uses sRGB as its default working color space (i.e., the color space in which color data is meant to be manipulated).

When choosing a color space, consider the following: sRGB can't be converted to a larger color space like Adobe RGB (although the opposite is true: Adobe RGB can be downsampled to sRGB). Also, no color space is assigned to RAW files, so if you expect to use different color spaces in your workflow, you can use RAW originals to process photos in the desired color space.

Precise and consistent color management requires ICC-compliant profiles for all devices in your workflow (e.g., digital camera and LCD display). A color profile is "a set of data that characterizes a color input or output device" [3]. Again, Thom Hogan explains this best [2]: "A Color Profile specifies how a device deviates from a Color Space. When we profile a monitor, printer, or sometimes a camera, we are essentially creating a map of how it differs from a Color Space definition. Savvy software can then use that map to 'fix' the color when rendered on or by that device so that it matches the Color Space definitions."

Setting Up a Color-Managed Workflow with digiKam

To illustrate how the color management theory works in practice, here is a real-world scenario: You use a digital camera to take photos as RAW files, which you process on a Linux machine using digiKam and view on an LCD display connected to the machine.

The first step is to create color profiles for the camera and the display. To calibrate a monitor and generate a color profile for it on Linux, you need two things: a colorimeter and color-profiling software. High-quality professional colorimeters tend to be rather expensive, but you can use the excellent low-cost ColorHug open source colorimeter [4] instead.

When it comes to calibration and profiling, dispcalGUI [5] is the perfect tool for the job (Figure 1). It provides a graphical user interface to the display calibration and profiling tools of the ArgyllCMS open source color management system. Next, you need to install the ColorHug library and client software. All software except dispcalGUI is available in most repositories, so you can install it using your distro's package manager. On Debian- and Ubuntu-based distributions, this can be done by running the following commands as root:

apt-get install argyll
apt-get install libcolorhug1 colorhug-client
Figure 1: DispcalGUI is an excellent tool for calibrating and profiling a display.

Next, download the packaged version of dispcalGUI from the project's website and install it on your system. Connect ColorHug, and it should blink briefly, indicating that it has been detected by the system. Before you start using ColorHug, make sure it has the latest version of firmware. Run the colorhug-flash command to launch the Firmware Updater utility and use it to check and upgrade ColorHug's firmware.

Now everything is ready to calibrate and profile the display. Launch dispcalGUI and press the Detect button to make dispcalGUI detect the connected colorimeter (it should appear in the Instrument/Port section). If you are using a multidisplay setup, make sure the correct monitor is selected in the Display device drop-down. Select Photo from the Settings drop-down list, press the Calibrate & profile button, and follow the instructions to calibrate the monitor and generate its color profile. (See the "Calibration and Profiling" box for more details.)

Calibration and Profiling

Calibration and profiling are often confused with each other, but these are two distinctly different processes. To simplify, calibration sets the device into its best native state using its hardware controls, whereas profiling (also called characterization) records the way a device reproduces or responds to color. See the explanation on the ArgyllCMS website [6] for further information.

Once the color profile has been generated, dispcalGUI prompts you to install the profile and enable it during boot. By the way, you can use dispcalGUI to install an existing ICC display profile, too. To do this, press the Load Settings icon next to the Settings drop-down list, and select the existing .icc file. Then use the Install Profile button to install the selected profile either globally or for the current user only.

The process of calibrating a digital camera consists of the following steps:

  • Take a RAW shot of a color calibration target.
  • Process the RAW file in digiKam without any color adjustments and save the result as a 16-bit TIFF image.
  • Generate a color matrix with ArgyllCMS and use it to create an ICC profile.

First, you need to obtain a color calibration target. Like colorimeters, professional color targets are rather expensive. Fortunately, Wolfgang Faust offers low-cost IT8-compliant color targets for calibrating various devices [7], including digital cameras (you need the C1 target). Each target production run is unique, so each batch of color targets is identified by its charge number (e.g., R131007), and every calibration target is supplied with its own reference file (e.g., R131007.txt).

The first step is to take a RAW shot of the color target using the camera you want to profile (Figure 2). This is actually trickier than it sounds, and valuable information on the subject can be found online [8]. Once you have the shot, launch digiKam and import the RAW file. Choose Settings | Configure digiKam, switch to the RAW Encoding section, and enable the Always open the Raw Import Tool to customize settings option. Then, press OK to save the changes. Select the RAW file and choose Image | Open (or press F4) to open it for editing. In the Raw Import tool, enable the 16 bits color depth option under the Raw Decoding tab, and press Import. Crop the photo to remove the background and save the result as a 16-bit TIFF file.

Figure 2: Processing the color target RAW file in digiKam.

To read the color patch values of the created TIFF file, use the command in Listing 1 (replace DSC00001.tif with the actual name of the TIFF file and R131007.txt with the reference file). Open the generated diag.tif file and make sure that all color patches have been indexed (Figure 3).

Listing 1

Reading Color Patch Values

scanin -v -p -a -dipn DSC00001.tif /usr/share/color/argyll/ref/it8.cht \
Figure 3: Indexed color target image should look something like this.

Finally, generate a color profile using the actual values instead of the defaults (Listing 2). This command generates a ready-to-use ICC camera color profile. To test the profile in digiKam, choose Settings | Configure digiKam, switch to the Color Management section, tick the Enable Color Management checkbox, and press OK. Open any RAW file taken with the profile camera in the Raw Import Tool. Under the Raw Decoding tab, scroll to the Color Management section, select Custom from the Camera Profile drop-down list and choose the created .icc file. Press the Update button, and you should see an improved version of the photo in the preview pane.

Listing 2

Generating a Color Profile

colprof -v -A "SONY" -M "SONY NEX-3N" -D "sony nex-3n" -C \
  "Copyright (c) 2015 Dmitri Popov. Some rights reserved." \
  -q l -a m -u DSC00001

The final step is to enable and configure color management functionality in digiKam using the available options in the Color Management section of the Configure dialog (Figure 4). The settings under the Behavior tab let you select a working color space and specify how digiKam should treat images with profiles that don't match the working color space or have no color information at all. As previously discussed, digiKam uses sRGB as its default working color space, which is suitable for most situations. Also, digiKam features sensible behavior defaults, so there is no need to change them unless your color workflow requires it.

Figure 4: Configuring digiKam's color management settings.

Using the options under the Profiles tab, you can specify color profiles for input and output devices. If a display color profile is already installed on your system, digiKam uses it by default. Although you can select a camera color profile on the fly when opening a RAW file in the Raw Import tool, you can also specify an input color profile globally. To do this, copy the desired .icc file to one of the default locations (e.g., /usr/share/color/icc), restart digiKam, and choose the color profile from the Default input color profile drop-down list under Color Management | Profiles.

Final Word

Color management is a complex topic, and I provide only a few starting points for mastering the color management fundamentals. Plenty of online resources can help you explore the topic, and the articles on Nine Degrees Below [8] offer quality information on key color-management related subjects.


  1. Overview of color management:
  2. Thom's Quick & Dirty Guide to Color Management:
  3. Color profile definiton:
  4. ColorHug:
  5. dispcalGUI:
  6. Calibration vs. characterization:
  7. IT8 color calibration targets by Wolf Faust:
  8. How to Make a Camera Input Profile Target Shot:
  9. Color management using free/libre software:

The Author

Dmitri Popov has been writing exclusively about Linux and open source software for many years, and his articles have appeared in Danish, British, US, German, Spanish, and Russian magazines and websites. Dmitri is an amateur photographer, and he writes about open source photography tools on his Scribbles and Snaps blog at

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95


njobs Europe
Njobs Netherlands Njobs Deutschland Njobs United Kingdom Njobs Italia Njobs France Njobs Espana Njobs Poland
Njobs Austria Njobs Denmark Njobs Belgium Njobs Czech Republic Njobs Mexico Njobs India Njobs Colombia