Technical Note TN2115

Image Color Management

Describes how to easily determine whether or not your application is properly color managed when drawing or printing images and how to modify your code to ensure it is color managed.

Introduction
Background - Mac OS X Color Management
The Problem
How can I verify color management in my application when drawing or printing images?
Why isn't my application being properly color managed when drawing or printing images?
How can I fix my application to be properly color managed when drawing or printing images?
References
Downloadables
Document Revision History

Introduction

With the growing prevalence of color digital media, such as digital photos, applications that handle color correctly when drawing or printing images benefit greatly by being able to accurately reproduce color over a wide range of devices. This results in a higher quality product and more satisfied customers. But how do you know if your application is properly color managed? Is there a simple test that will give you this information?

This Technote describes one technique for determining whether or not your application is being properly color managed when drawing or printing images.

Background - Mac OS X Color Management

Mac OS X takes a system-wide approach to managing color data by integrating ICC color management via ColorSync into all layers of the graphics stack (for more information about ColorSync, please see TN2035: ColorSync on Mac OS X).

As Figure 1 shows, ColorSync is built into the system at a low level on top of Darwin. Built on top of ColorSync are a variety of graphics frameworks providing a diverse set of functionality, and most all of these frameworks make use of color management provided by ColorSync.

Figure 1  ColorSync Architectural Diagram

Developers who take advantage of the various color managed frameworks in Mac OS X can be confident their applications will display and print images correctly. For example, ColorSync color management on Mac OS X will recognize any profile embedded in an image for the following file formats:

JPEG, GIF, TIFF, PNG, PSD, PICT

When such images are then drawn or printed, the embedded image profile will be correctly color matched against a profile for the destination device (for example a monitor or printer). If no embedded profile is provided with the image file, Mac OS X will assume a Generic RGB color space (see TN2035: ColorSync on Mac OS X and Q&A 1396 Creating color spaces that ensure color matching).

The Problem

Color plays a very important role in the world of digital media. Color makes a difference—often a dramatic difference—in your images and graphics. Users can be very disappointed when they display or print an image and the color is vastly different from expectations. For this reason, applications that handle color correctly gain a distinct advantage over those that don't. But managing color correctly in your application can be increasingly difficult, and the availability of a wide variety of different image libraries complicates matters even further

So how do you really know if drawing or printing of images is being properly color managed in your application?

Or what if you also make use of a third-party framework in your application? Is there a simple technique for verifying proper color management when displaying or printing images in your application?

One simple technique is the use of images with embedded "trick" profiles. This Technote describes this technique.

How can I verify color management in my application when drawing or printing images?

Included with this Technote are a set of image files with embedded "trick" profiles. These aren't "normal" profiles you would expect to see in a typical image file. Instead, these profiles were specially made to allow you to easily tell whether or not ColorSync color management is being performed when the image is drawn or printed. Simply look at the message displayed and you will know right away if the proper color management is being performed (the image files were constructed to display different colors when color managed).

For example, if you draw or print the enclosed image file "TestRGB.jpg" in an application which correctly performs color management (such as the Mac OS X Preview application) you should see the output as shown in Figure 2 below. This indicates the application is being properly color managed. In this case, the embedded image profile is being recognized by ColorSync and is being color-matched against an appropriate destination profile:

Figure 2  Image file properly color managed.

On the other hand, if you see the following output when drawing/printing the same image then you know your application is not being properly color managed. In this case, the embedded image profile is not being taken into account for any drawing or printing operation.

Figure 3  Image file *not* properly color managed.

Why isn't my application being properly color managed when drawing or printing images?

If you display or print the enclosed images with "trick" profiles in your application and you find they are not being properly color managed it can be for one of the following reasons:

How can I fix my application to be properly color managed when drawing or printing images?

What can you do to ensure your application will be properly color managed when drawing or printing images? Follow these guidelines:

For examples of code written using one of the color managed frameworks in Mac OS X take a look at the available Graphics & Imaging sample code on the ADC website. For example, see the ImageApp sample code for a good example of use of the Image I/O framework.

Use the Image I/O framework for image handling

We recommend use of the Image I/O framework, introduced in Mac OS X v10.4, for working with images in your application. The Image I/O framework provides image reading or writing functionality for the Core Graphics framework (the Core Graphics framework and the the Image I/O framework together comprise the Quartz 2D API). The Image I/O framework is also a companion framework to CGImage.

Why make use of the Image I/O framework in your application? Because the Image I/O framework makes it easy to work with image file formats in a color managed way. The Image I/O framework provides the best compromise between an API which is easy to work with but at the same time provides access to a diverse set of options.

The Image I/O framework currently supports the following image file formats:

  • Web standards

    TIFF, JPEG, PNG, GIF, JPEG-2000

  • Floating Point HDR formats

    OpenEXR, Radiance, LogLuv TIFF, Float TIFF, and Pixar TIFF

  • Camera Raw formats

    Canon, Nikon, Minolta, Olympus, Sony

  • Others

    .bmp, .psd, .qtif, .tga, .sgi, .xbm, .icns, .ico, .pict, .ptng, .fpx

  • MetaData

    Exif, IPTC, CIFF, GPS, some MakerNotes, …

ImageIO supports embedded profiles for the following image file formats:

- JPEG, GIF, TIFF, PNG, PSD, PICT

References

Downloadables



Document Revision History


DateNotes
2006-11-01

New document that learn how to properly support color management in your application.