Color Management

Top Previous Topic Next Topic  Print this topic

Graphics professionals know the importance of color management. No matter how much thought an user puts into the color scheme for a given project, all of that work is for naught if the user can not get the printed results to match the expectations.

 

Each color is encoded as a combination of Red, Green and Blue values. What do these values mean? e.g. what color is 88/249/17? Without any context, it is a meaningless triplet of numbers. This is where color spaces come in.

 

A color space provides the definition for what color the numerical combination represents.

If our example of 88/249/17 is interpreted using the Adobe RGB color space, it is a vibrant, attention getting green. If, on the other hand, the same value is interpreted using the sRGB color space, it is a pale, yellowish-green.

 

                       (88, 249, 17) in Adobe RGB The same RGB value in sRGB

 

RGB Colors

 

By default all colors used in the XSL-FO documents are considered to be given in the sRGB color space.

 

To use RGB colors, the user can either specify values for the each component (Red, Green and Blue), or a color name. XF Rendering Server supports the extended palette described in the SVG specifications for both SVG and XSL-FO input.

 

The following notations are equivalent:

 

 

       <fo:block color="red">Red text.</fo:block>

       

       <fo:block color="rgb(255,0,0)">Red text.</fo:block>

       

       <fo:block color="rgb(100%,100%,100%)">Red text.</fo:block>

       

       <fo:block color="#FF0000">Red text.</fo:block>

       

       <fo:block color="#F00">Red text.</fo:block>

 

 

The last notation is called a short notation. The three-digit RGB notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. For example, #fb0 expands to #ffbb00.

 

When generating PDF, all RGB colors are mapped to a predefined PDF color space called DeviceRGB.

 

CMYK Colors

 

An Ecrion specific extension can be used for specifying colors in CMYK (Cyan,Magenta,Yellow,Black) format:

 

       

       <fo:block color="cmyk(0,100,100,0)">Red text.</fo:block>

 

 

When generating PDF, all CMYK colors specified using this extension are mapped to DeviceCMYK color space.

 

Also, CMYK color profile can be used with Ecrion products. More information is available below.

 

ICC Profiles

 

In addition, the XSL-FO recommendation specifies how to use colors described by an external ICC profile. With accurate monitor and printer profiles, the prints will closely match what is displayed on the monitor.

 

To declare a color space the fo:color-profile attribute must be used.\

 

Example of usage:

 

 

<?xml version="1.0" encoding="utf-8" ?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

       <fo:declarations>

               <fo:color-profile color-profile-name="RGBColorProfile" src="ColorProfiles\RGB\AppleRGB.icc"/>

               <fo:color-profile color-profile-name="CMYKColorProfile" src="ColorProfiles\CMYK\USWebCoatedSWOP.icc"/> (1)

         </fo:declarations>

         <fo:layout-master-set>

               <fo:simple-page-master master-name="all-pages" page-width="8in" page-height="11in">

                         <fo:region-body region-name="xsl-region-body" column-gap="0.25in" padding-top="6pt" padding-left="6pt" padding-right="6pt" padding-bottom="6pt" margin-top="0.7in" margin-left="0.7in" margin-right="0.7in" margin-bottom="0.7in"/>

                         <fo:region-before region-name="xsl-region-before" display-align="after" extent="0.7in"padding-top="6pt" padding-left="0.7in" padding-right="0.7in" padding-bottom="6pt"/>

                         <fo:region-after region-name="xsl-region-after" display-align="before" extent="0.7in" padding-top="6pt" padding-left="0.7in" padding-right="0.7in" padding-bottom="6pt"/>

               </fo:simple-page-master>

               <fo:page-sequence-master master-name="default-sequence">

                       <fo:repeatable-page-master-reference master-reference="all-pages"/>

               </fo:page-sequence-master>

         </fo:layout-master-set>

         <fo:page-sequence master-reference="default-sequence">

               <fo:flow flow-name="xsl-region-body"font-size="12pt" font-family="Times New Roman">

                         <fo:block background="rgb(255,0,0)">RGB Color</fo:block>

                         <fo:block background="rgb-icc(255,0,0,#RGBColorProfile,1,0,0)">ICC RGB Color</fo:block> (2)

          <fo:block background="rgb-icc(255,0,0,#CMYKColorProfile,0,1,1,0)">ICC CMYK Color</fo:block>

          <fo:block background="rgb(0,255,0)">RGB Color</fo:block>

          <fo:block background="rgb-icc(0,255,0,#RGBColorProfile,0,1,0)">ICC RGB Color</fo:block>

          <fo:block background="rgb-icc(0,255,0,#CMYKColorProfile,0.63,0,1,0)">ICC CMYK Color</fo:block>

          <fo:block background="rgb(255,0,255)">RGB Color</fo:block>

          <fo:block background="rgb-icc(255,0,255,#RGBColorProfile,1,0,1)">ICC RGB Color</fo:block>

          <fo:block background="rgb-icc(255,0,255,#CMYKColorProfile,0.27,0.82,0,0)">ICC CMYK Color</fo:block>

               </fo:flow>

         </fo:page-sequence>

</fo:root>

 

 

 

Key observations:

 

(1) Two color spaces, named "RGBColorProfile" and "CMYKColorProfile" have been declared.

(2) The rgb-icc function is used for specifying the intensities of each component in this color space. This function's name is a little misleading, because rgb-icc can be used to describe not only RGB (Red, Green, Blue) colors, but also Grascale, CMYK and spot (Pantone) colors.

 

rgb-icc has the following arguments:

 

 

       rgb-icc(fallbackRed,fallbackGreen,fallbackBlue,#colorProfileReference, component1,..., componentN)

 

 

·First three parameters are used when the color profile can not be found or when the document is displayed in XF Designer.
·The fourth parameter is a reference to a color profile declared with the fo:color-profile attribute.
·The fifth and next parameters are used for specifying the color.

 

If the color profile is a Grayscale color profile, only "component1" will be used.

If the color profile is RGB, three values must be used, while for a CMYK color profile four values are needed.

Each value is a floating point number, must take values between 0.00 and 1.00 and represents the color's intensity.

 

Note:

·XF Rendering Server will output an error if the number of components specified when using rgb-icc does not match the number of colors defined in the color profile.

 

Also, color profiles can be assigned to images and SVG documents using the xf:color-profile attribute.

 

Example of usage:

 

 

<?xml version="1.0" encoding="utf-8" ?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0">

...

<fo:block>

       <fo:external-graphic src="redsquare.svg" xf:color-profile="#CMYKColorProfile"/>

</fo:block>

 

 

Note:

· xf namespace must be declared; usually this is done as exemplified above, in the root element.

 

Blending Color Space

PDF documents that contain transparent RGB images may not print correctly on CMYK printers. This happens due to the blending being done with respect to the color space of the output device. If elements in RGB are used and the calculation is occurring in CMYK (the default of most printers), poor results will be achieved.

 

To correct this, the Blending color space can be explicitly set by using the xf:pdf-page-settings attribute.

 

Usage:

 

 

       <xf:pdf-page-settings blending-color-space="DeviceNative | DeviceRGB | DeviceCMYK |DeviceGray | custom"/>

 

 

Example of usage on how to use an external ICC profile:

 

 

<?xml version="1.0" encoding="utf-8" ?>

<fo:root>

       <xf:pdf-page-settings blending-color-space="#CustomCMYKProfile"/>

       <fo:declarations>

               <fo:color-profile color-profile-name="CustomCMYKProfile" src="Adobe ICC Profiles\CMYK Profiles\EuroscaleCoated.icc"/>

       </fo:declarations>

<fo:layout-master-set>

...

</fo:layout-master-set>

</fo:root>