Looking good: Basic color management for X

183

Author: Nathan Willis

Periodically I hear someone say that Linux isn’t suitable for graphic design work. One common complaint is its lack of an integrated system-wide color management system (CMS). Fortunately today’s Linux systems have free cross-platform open source color management alternatives.

To those who work primarily with graphic data, having a color-managed system is as important as having CVS is to a programmer: it takes care of a well-understood problem by abstracting the details. You set it up once and let it handle the repetitive-but-important tasks so you can keep your mind on design questions.

The big technical hurdle graphic designers, photographers, and other media people have to overcome is that no two devices in the world register or reproduce color in the same way. Ink, phosphor, fluorescent lamps, the human eye — all compose colors in different ways, using different primaries, with different results.

And there are different colorspaces — mathematical models for describing color. Even when you’re using an RGB colorspace, the particular wavelengths of red, green, and blue that you define as your primaries restrict which and how many colors your model can describe. An NTSC television signal has one set of red, green, and blue primaries, your computer monitor has another, and an image file might have yet a third.

Consequently, to move an image from one domain to another and ensure it looks the same, you have to profile the characteristics of each domain, then translate the image data from the first profile to the second. In this sense, the “domain” in question may be either an input or output hardware device (i.e., a scanner or a printer) or a file (think about that — the file serves as both input and output at varying times).

A lingua franca

That’s all that a color management system does: translate the image data when it moves from one source to another. This requires a profile of each hardware device and its color characteristics. The profile is simply a numeric table mapping the relationship between the device’s image data and the corresponding colors in a standardized, device-independent colorspace called the profile connection space (PCS). The equivalent profile for an image file (instead of a hardware device) describes the file’s colorspace in relation to the PCS. The format of this data is defined by the International Color Consortium, so they are frequently called ICC profiles and use the file extension .icc.

Every device and every colorspace has a slightly different gamut, or range of possible colors. To be a useful reference point, the PCS has to encompass all of the possibilities. The standard is the color model defined by the nonprofit CIE — the International Commission on Illumination — that encompasses the full gamut of light visible to the human eye. There are two colorspaces that describe this gamut, CIE-XYZ and CIELab. They describe the same gamut, but in different ways — CIE-XYZ is a traditional RGB model, and CIELab uses a Luminance component (L) and two color-balance components (a and b). But we need not delve into the technical differences; we’re letting the CMS worry about that.

So the CMS can translate the {red,green,blue} triples generated by a desktop scanner into the equivalent sRGB data you store in a JPEG or TIFF file, NTSC-compatible colors for use in video, or even the CMYK quadruples needed by a printer — all by transforming the data through this common denominator.

It’s a straightforward enough idea if you just want to match your printouts as closely as possible to what you see on your screen. The CMS maps the data from one space to the other, squeezing or expanding the gamut of colors to make the best perceptual match. This gamut-mapping behavior is referred to as perceptual intent, and is the most common.

But the CMS can be used with other “intents” — notably colorimetric intents, useful for cases where going out of gamut is seriously bad and you need to know about it. You can use the CMS to make proofs that reproduce the in-gamut colors exactly and clip out-of-gamut colors entirely, which should help grabbing your attention before you send your annual report off to the printers and it comes back looking surprisingly ugly.

Sounds good in theory, right?

So how do mere mortals use color management? Well, Apple’s color management system is called ColorSync, Microsoft’s is called Image Color Management, and both are fairly integrated into their operating systems. On both of these platforms, however, Adobe software is the standard for image manipulation, and Adobe Photoshop has its own built-in color management subsystem. Fortunately the rest of us have a free software alternative.

On today’s Linux systems, the most common CMS is Little CMS, a cross-platform open source project run by Marti Maria. Little CMS implements a library called liblcms, which exposes color-management functions to interested applications. The Little CMS distribution also includes two command-line tools for embedding ICC profiles in TIFF and JPEG images, called tifficc and jpegicc respectively.

Two prominent applications that use Little CMS are Scribus, the WSYIWYG desktop publishing program, and Cinepaint, the free film-retouching offshoot of the GIMP.

In both applications, you must activate color management through a preferences panel. Once you have done so, you select the profiles for your monitor and printer, choose a working profile, and set whether you want to run color management with a perceptual or colorimetric intent. The rest is done automatically. With a color-managed system, you can now build documents with Scribus, incorporating images edited in Cinepaint, and have confidence that what you see (on your properly calibrated
monitor
, of course) really is what you will get.

Of course, two applications isn’t a lot, and you lose all the benefits of color management if you only use it half the time. The big gaping hole in the color-managed Linux workflow at the moment is the GIMP. The current release, 2.2, does not support any form of color management. The developers have indicated that future releases will include color management, but in the meantime you have to work around this omission. The best thing you can do is use Cinepaint instead of the GIMP when you have to match colors. I frequently use Cinepaint for photographic images anyway, since it supports 48-bit color like high-end scanners and digital cameras do.

On the other hand, the current version Cinepaint is several revisions behind the GIMP when it comes to tools and other features — it has standard photo-retouching capabilities, since that is its purpose, but little else. But there is no reason that you cannot create graphics with the GIMP and then finalize them with Cinepaint, applying the proper ICC profile to the file.

Lose the profiling blues

Of course, making all of this work hinges on having accurate ICC profiles. To get these, you can take several routes. Many printer and scanner manufacturers include ICC profiles for their products on the bundled driver disks — something useful to the Linux user, for once! These are generally good, although it would not hurt to run some tests and profile your own devices if you want to squeeze the maximum out of your hardware.

Displays are a little bit trickier. There are some excellent Windows and Mac profiling tools (both freeware and commercial), and some people report having success using these tools under WINE. Alternatively, you could generate profiles under another operating system and simply copy the .icc file to your Linux installation. Be forewarned, though, that this is not a perfect solution; each OS may not treat your hardware the same way. In particular, Windows and Mac OS can alter the video look-up table (LUT) for many displays, but X cannot.

There are also freely available ICC profiles. Adobe offers free downloads of some common file profiles including sRGB and AdobeRGB. They also include some generic CMYK profiles, but they are less useful. A CMYK profile is really only useful for professional-level print shop printers. Desktop printers such as the ones most of us have attached to our PCs — even high-quality photo printers that have 6 or 8 inks — actually expect data in RGB form. If you’re skeptical that this is true, consider how many printer models these days come with the ability to print directly from cameras or memory cards; there is no RGB-to-CMYK conversion step performed.

If you want the highest quality profile that free software can buy, check out Graeme Gill’s Argyll utilities. Argyll is a complete color management system like Little CMS, though Little CMS is used by more Linux applications. More importantly, Argyll supplies a full set of utilities to perform monitor, scanner, and printer profiling. That is a complicated task; when you are ready to try it, the online documentation will guide you through the steps. Until then, just know that the tools are there.

Color me distribution-deployed

Right now, color management on Linux and other free operating systems is usable for those people who care about it, and, like font support just a few years ago, it is on the threshold of widespread adoption, lacking only a push from major vendors to really take off. The technical work is done, but it is left to the enterprising user to activate it and take advantage. Hopefully more and more applications are adding support for color management, through Little CMS, Argyll, or some as-yet-undiscovered alternative. Ideally any program that displays or processes image data can and should be ICC-aware. Different applications can depend on different CMS code, and as long as both are well-written and use the same ICC profiles they will coexist peacefully.

Can you work on graphics without using color management? Yes, of course. But you will spend extra hours and extra money on repeated proofing and printing steps.