This documentation is for the old version. Go to the latest Graphics Mill docs

Using Color Management in Graphics Mill for .NET

As discussed in the article Basic Concepts of Color Management, color management is used to adjust the colors of images to represent them identically on different color devices. Another problem solved by color management is the translation between RGB and CMYK color spaces. As mentioned in the color spaces overview, this conversion is ambiguous. Some RGB colors can be represented in CMYK in multiple ways. Moreover, color gamuts of RGB and CMYK are noticeable different. There are a lot of colors in RGB color space which cannot be reproduced in CMYK and vice versa - some colors of CMYK cannot be received in RGB. Color profiles resolve these problems. The code samples from the article Converting Colors with Color Management demonstrate why color profiles are important for the conversion between the color spaces and how to use them with Graphics Mill for .NET.

The conception of the device profile makes up the basis of the color management. From the article Basic Concepts of Color Management we know that device profiles can be embedded within image files. So Graphics Mill for .NET supports the loading device profiles from the following image formats:

The article Loading and Saving Files with ICC Profiles demonstrates how to work with profile, embedded into bitmap.

Managing Input and Output Profiles

To be able to apply the color management for converting pixels between color spaces, we need to specify input profile (profile of the original image) and output profile (profile of the device which color space we convert pixels in). Color profiles are represented by the ColorProfile class.

With Graphics Mill for .NET input profile is loaded from the image or assigned later, and available through the Bitmap.ColorProfile property.

To change color management settings including output profiles, you should use ColorManagementProvider class instance returned by the ColorManagement property of the Bitmap. Output profie should be specified for each supported color space. Use RgbColorProfile, CmykColorProfile, or GrayScaleColorProfile properties of the ColorManagementProvider to specify necessary output profile for necessary color space. If you assign null to some of these properties color management is disabled for these color spaces.

Color Conversion

When you convert pixels with Graphics Mill for .NET, you can enable color management. Here your can choose one of the available engines, namely Adobe® Color Management Module (CMM) and LittleCMS engine. Find the detailed information about Adobe ® CMM in the Using Adobe Color Management Module with Graphics Mill for .NET topic.

Graphics Mill for .NET provides two ways to specify color management engine:

  • Using ColorManagementProvider returned by the ColorManagement property of the Bitmap class instance. In this case you can choose the color management engine with the ColorManagementProvider.ColorManagementEngine property.

    Visual Basic
    Dim bitmap As New Aurigma.GraphicsMill.Bitmap
    bitmap.ColorManagement.ColorManagementEngine = Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms
    
    C#
    Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap();
    bitmap.ColorManagement.ColorManagementEngine = Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms;
    
  • Using PixelFormatConverter transform class. It also has ColorManagementEngine property which works in the same way.

    Visual Basic
    Dim converter As New Aurigma.GraphicsMill.Transforms.PixelFormatConverter
    converter.ColorManagementEngine = Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms
    
    C#
    Aurigma.GraphicsMill.Transforms.PixelFormatConverter converter = 
        new Aurigma.GraphicsMill.Transforms.PixelFormatConverter();
    converter.ColorManagementEngine = Aurigma.GraphicsMill.Transforms.ColorManagementEngine.LittleCms;
    

Color management will be applied even if you convert pixels inside the same color space (for example, RGB -> RGB). If input and output color profiles are different, pixels will be transformed to fit the output profile.

Color Proofing

There is more complicated way of color translation: when three device profiles are used during conversion. It is necessary when you need to preview the colors which will appear on some target device (for example, on printer). So we need to bear in mind profiles both of the monitor and target device. The figure below demonstrates this.

Color conversion diagram

In this example the digital camera profile stands as an input profile, the monitor profile stands as an output profile, and the printer profile stands as a target profile. Target profile can be set through the property TargetColorProfile of the ColorManagementProvider returned by the Bitmap class. Set null to disable this feature and apply plain conversion with two profiles. The code example for this feature can be found in the article Displaying Images with Color Management.