ImageCms Module

The ImageCms module provides color profile management support using the LittleCMS2 color management engine, based on Kevin Cazabon’s PyCMS library.

class PIL.ImageCms.ImageCmsTransform(input, output, input_mode, output_mode, intent=0, proof=None, proof_intent=3, flags=0)

Transform. This can be used with the procedural API, or with the standard Image.point() method.

Will return the output profile in the output.info[‘icc_profile’].

exception PIL.ImageCms.PyCMSError

(pyCMS) Exception class. This is used for all errors in the pyCMS API.

PIL.ImageCms.applyTransform(im, transform, inPlace=0)

(pyCMS) Applies a transform to a given image.

If im.mode != transform.inMode, a PyCMSError is raised.

If inPlace == TRUE and transform.inMode != transform.outMode, a PyCMSError is raised.

If im.mode, transfer.inMode, or transfer.outMode is not supported by pyCMSdll or the profiles you used for the transform, a PyCMSError is raised.

If an error occurs while the transform is being applied, a PyCMSError is raised.

This function applies a pre-calculated transform (from ImageCms.buildTransform() or ImageCms.buildTransformFromOpenProfiles()) to an image. The transform can be used for multiple images, saving considerable calculation time if doing the same conversion multiple times.

If you want to modify im in-place instead of receiving a new image as the return value, set inPlace to TRUE. This can only be done if transform.inMode and transform.outMode are the same, because we can’t change the mode in-place (the buffer sizes for some modes are different). The default behavior is to return a new Image object of the same dimensions in mode transform.outMode.

Parameters:
  • im – A PIL Image object, and im.mode must be the same as the inMode supported by the transform.
  • transform – A valid CmsTransform class object
  • inPlace – Bool (1 == True, 0 or None == False). If True, im is modified in place and None is returned, if False, a new Image object with the transform applied is returned (and im is not changed). The default is False.
Returns:

Either None, or a new PIL Image object, depending on the value of inPlace. The profile will be returned in the image’s info[‘icc_profile’].

Raises:

PyCMSError

PIL.ImageCms.buildProofTransform(inputProfile, outputProfile, proofProfile, inMode, outMode, renderingIntent=0, proofRenderingIntent=3, flags=16384)

(pyCMS) Builds an ICC transform mapping from the inputProfile to the outputProfile, but tries to simulate the result that would be obtained on the proofProfile device.

If the input, output, or proof profiles specified are not valid filenames, a PyCMSError will be raised.

If an error occurs during creation of the transform, a PyCMSError will be raised.

If inMode or outMode are not a mode supported by the outputProfile (or by pyCMS), a PyCMSError will be raised.

This function builds and returns an ICC transform from the inputProfile to the outputProfile, but tries to simulate the result that would be obtained on the proofProfile device using renderingIntent and proofRenderingIntent to determine what to do with out-of-gamut colors. This is known as “soft-proofing”. It will ONLY work for converting images that are in inMode to images that are in outMode color format (PIL mode, i.e. “RGB”, “RGBA”, “CMYK”, etc.).

Usage of the resulting transform object is exactly the same as with ImageCms.buildTransform().

Proof profiling is generally used when using an output device to get a good idea of what the final printed/displayed image would look like on the proofProfile device when it’s quicker and easier to use the output device for judging color. Generally, this means that the output device is a monitor, or a dye-sub printer (etc.), and the simulated device is something more expensive, complicated, or time consuming (making it difficult to make a real print for color judgement purposes).

Soft-proofing basically functions by adjusting the colors on the output device to match the colors of the device being simulated. However, when the simulated device has a much wider gamut than the output device, you may obtain marginal results.

Parameters:
  • inputProfile – String, as a valid filename path to the ICC input profile you wish to use for this transform, or a profile object
  • outputProfile – String, as a valid filename path to the ICC output (monitor, usually) profile you wish to use for this transform, or a profile object
  • proofProfile – String, as a valid filename path to the ICC proof profile you wish to use for this transform, or a profile object
  • inMode – String, as a valid PIL mode that the appropriate profile also supports (i.e. “RGB”, “RGBA”, “CMYK”, etc.)
  • outMode – String, as a valid PIL mode that the appropriate profile also supports (i.e. “RGB”, “RGBA”, “CMYK”, etc.)
  • renderingIntent

    Integer (0-3) specifying the rendering intent you wish to use for the input->proof (simulated) transform

    INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL) INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC) INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION) INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)

    see the pyCMS documentation for details on rendering intents and what they do.

  • proofRenderingIntent

    Integer (0-3) specifying the rendering intent you wish to use for proof->output transform

    INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL) INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC) INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION) INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)

    see the pyCMS documentation for details on rendering intents and what they do.

  • flags – Integer (0-...) specifying additional flags
Returns:

A CmsTransform class object.

Raises:

PyCMSError

PIL.ImageCms.buildProofTransformFromOpenProfiles(inputProfile, outputProfile, proofProfile, inMode, outMode, renderingIntent=0, proofRenderingIntent=3, flags=16384)

(pyCMS) Builds an ICC transform mapping from the inputProfile to the outputProfile, but tries to simulate the result that would be obtained on the proofProfile device.

If the input, output, or proof profiles specified are not valid filenames, a PyCMSError will be raised.

If an error occurs during creation of the transform, a PyCMSError will be raised.

If inMode or outMode are not a mode supported by the outputProfile (or by pyCMS), a PyCMSError will be raised.

This function builds and returns an ICC transform from the inputProfile to the outputProfile, but tries to simulate the result that would be obtained on the proofProfile device using renderingIntent and proofRenderingIntent to determine what to do with out-of-gamut colors. This is known as “soft-proofing”. It will ONLY work for converting images that are in inMode to images that are in outMode color format (PIL mode, i.e. “RGB”, “RGBA”, “CMYK”, etc.).

Usage of the resulting transform object is exactly the same as with ImageCms.buildTransform().

Proof profiling is generally used when using an output device to get a good idea of what the final printed/displayed image would look like on the proofProfile device when it’s quicker and easier to use the output device for judging color. Generally, this means that the output device is a monitor, or a dye-sub printer (etc.), and the simulated device is something more expensive, complicated, or time consuming (making it difficult to make a real print for color judgement purposes).

Soft-proofing basically functions by adjusting the colors on the output device to match the colors of the device being simulated. However, when the simulated device has a much wider gamut than the output device, you may obtain marginal results.

Parameters:
  • inputProfile – String, as a valid filename path to the ICC input profile you wish to use for this transform, or a profile object
  • outputProfile – String, as a valid filename path to the ICC output (monitor, usually) profile you wish to use for this transform, or a profile object
  • proofProfile – String, as a valid filename path to the ICC proof profile you wish to use for this transform, or a profile object
  • inMode – String, as a valid PIL mode that the appropriate profile also supports (i.e. “RGB”, “RGBA”, “CMYK”, etc.)
  • outMode – String, as a valid PIL mode that the appropriate profile also supports (i.e. “RGB”, “RGBA”, “CMYK”, etc.)
  • renderingIntent

    Integer (0-3) specifying the rendering intent you wish to use for the input->proof (simulated) transform

    INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL) INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC) INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION) INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)

    see the pyCMS documentation for details on rendering intents and what they do.

  • proofRenderingIntent

    Integer (0-3) specifying the rendering intent you wish to use for proof->output transform

    INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL) INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC) INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION) INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)

    see the pyCMS documentation for details on rendering intents and what they do.

  • flags – Integer (0-...) specifying additional flags
Returns:

A CmsTransform class object.

Raises:

PyCMSError

PIL.ImageCms.buildTransform(inputProfile, outputProfile, inMode, outMode, renderingIntent=0, flags=0)

(pyCMS) Builds an ICC transform mapping from the inputProfile to the outputProfile. Use applyTransform to apply the transform to a given image.

If the input or output profiles specified are not valid filenames, a PyCMSError will be raised. If an error occurs during creation of the transform, a PyCMSError will be raised.

If inMode or outMode are not a mode supported by the outputProfile (or by pyCMS), a PyCMSError will be raised.

This function builds and returns an ICC transform from the inputProfile to the outputProfile using the renderingIntent to determine what to do with out-of-gamut colors. It will ONLY work for converting images that are in inMode to images that are in outMode color format (PIL mode, i.e. “RGB”, “RGBA”, “CMYK”, etc.).

Building the transform is a fair part of the overhead in ImageCms.profileToProfile(), so if you’re planning on converting multiple images using the same input/output settings, this can save you time. Once you have a transform object, it can be used with ImageCms.applyProfile() to convert images without the need to re-compute the lookup table for the transform.

The reason pyCMS returns a class object rather than a handle directly to the transform is that it needs to keep track of the PIL input/output modes that the transform is meant for. These attributes are stored in the “inMode” and “outMode” attributes of the object (which can be manually overridden if you really want to, but I don’t know of any time that would be of use, or would even work).

Parameters:
  • inputProfile – String, as a valid filename path to the ICC input profile you wish to use for this transform, or a profile object
  • outputProfile – String, as a valid filename path to the ICC output profile you wish to use for this transform, or a profile object
  • inMode – String, as a valid PIL mode that the appropriate profile also supports (i.e. “RGB”, “RGBA”, “CMYK”, etc.)
  • outMode – String, as a valid PIL mode that the appropriate profile also supports (i.e. “RGB”, “RGBA”, “CMYK”, etc.)
  • renderingIntent

    Integer (0-3) specifying the rendering intent you wish to use for the transform

    INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL) INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC) INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION) INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)

    see the pyCMS documentation for details on rendering intents and what they do.

  • flags – Integer (0-...) specifying additional flags
Returns:

A CmsTransform class object.

Raises:

PyCMSError

PIL.ImageCms.buildTransformFromOpenProfiles(inputProfile, outputProfile, inMode, outMode, renderingIntent=0, flags=0)

(pyCMS) Builds an ICC transform mapping from the inputProfile to the outputProfile. Use applyTransform to apply the transform to a given image.

If the input or output profiles specified are not valid filenames, a PyCMSError will be raised. If an error occurs during creation of the transform, a PyCMSError will be raised.

If inMode or outMode are not a mode supported by the outputProfile (or by pyCMS), a PyCMSError will be raised.

This function builds and returns an ICC transform from the inputProfile to the outputProfile using the renderingIntent to determine what to do with out-of-gamut colors. It will ONLY work for converting images that are in inMode to images that are in outMode color format (PIL mode, i.e. “RGB”, “RGBA”, “CMYK”, etc.).

Building the transform is a fair part of the overhead in ImageCms.profileToProfile(), so if you’re planning on converting multiple images using the same input/output settings, this can save you time. Once you have a transform object, it can be used with ImageCms.applyProfile() to convert images without the need to re-compute the lookup table for the transform.

The reason pyCMS returns a class object rather than a handle directly to the transform is that it needs to keep track of the PIL input/output modes that the transform is meant for. These attributes are stored in the “inMode” and “outMode” attributes of the object (which can be manually overridden if you really want to, but I don’t know of any time that would be of use, or would even work).

Parameters:
  • inputProfile – String, as a valid filename path to the ICC input profile you wish to use for this transform, or a profile object
  • outputProfile – String, as a valid filename path to the ICC output profile you wish to use for this transform, or a profile object
  • inMode – String, as a valid PIL mode that the appropriate profile also supports (i.e. “RGB”, “RGBA”, “CMYK”, etc.)
  • outMode – String, as a valid PIL mode that the appropriate profile also supports (i.e. “RGB”, “RGBA”, “CMYK”, etc.)
  • renderingIntent

    Integer (0-3) specifying the rendering intent you wish to use for the transform

    INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL) INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC) INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION) INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)

    see the pyCMS documentation for details on rendering intents and what they do.

  • flags – Integer (0-...) specifying additional flags
Returns:

A CmsTransform class object.

Raises:

PyCMSError

PIL.ImageCms.createProfile(colorSpace, colorTemp=-1)

(pyCMS) Creates a profile.

If colorSpace not in [“LAB”, “XYZ”, “sRGB”], a PyCMSError is raised

If using LAB and colorTemp != a positive integer, a PyCMSError is raised.

If an error occurs while creating the profile, a PyCMSError is raised.

Use this function to create common profiles on-the-fly instead of having to supply a profile on disk and knowing the path to it. It returns a normal CmsProfile object that can be passed to ImageCms.buildTransformFromOpenProfiles() to create a transform to apply to images.

Parameters:
  • colorSpace – String, the color space of the profile you wish to create. Currently only “LAB”, “XYZ”, and “sRGB” are supported.
  • colorTemp – Positive integer for the white point for the profile, in degrees Kelvin (i.e. 5000, 6500, 9600, etc.). The default is for D50 illuminant if omitted (5000k). colorTemp is ONLY applied to LAB profiles, and is ignored for XYZ and sRGB.
Returns:

A CmsProfile class object

Raises:

PyCMSError

PIL.ImageCms.getDefaultIntent(profile)

(pyCMS) Gets the default intent name for the given profile.

If profile isn’t a valid CmsProfile object or filename to a profile, a PyCMSError is raised.

If an error occurs while trying to obtain the default intent, a PyCMSError is raised.

Use this function to determine the default (and usually best optimized) rendering intent for this profile. Most profiles support multiple rendering intents, but are intended mostly for one type of conversion. If you wish to use a different intent than returned, use ImageCms.isIntentSupported() to verify it will work first.

Parameters:profile – EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile.
Returns:Integer 0-3 specifying the default rendering intent for this profile.
INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL) INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC) INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION) INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
see the pyCMS documentation for details on rendering intents and what
they do.
Raises:PyCMSError
PIL.ImageCms.getOpenProfile(profileFilename)

(pyCMS) Opens an ICC profile file.

The PyCMSProfile object can be passed back into pyCMS for use in creating transforms and such (as in ImageCms.buildTransformFromOpenProfiles()).

If profileFilename is not a vaild filename for an ICC profile, a PyCMSError will be raised.

Parameters:profileFilename – String, as a valid filename path to the ICC profile you wish to open, or a file-like object.
Returns:A CmsProfile class object.
Raises:PyCMSError
PIL.ImageCms.getProfileCopyright(profile)

(pyCMS) Gets the copyright for the given profile.

If profile isn’t a valid CmsProfile object or filename to a profile, a PyCMSError is raised.

If an error occurs while trying to obtain the copyright tag, a PyCMSError is raised

Use this function to obtain the information stored in the profile’s copyright tag.

Parameters:profile – EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile.
Returns:A string containing the internal profile information stored in an ICC tag.
Raises:PyCMSError
PIL.ImageCms.getProfileDescription(profile)

(pyCMS) Gets the description for the given profile.

If profile isn’t a valid CmsProfile object or filename to a profile, a PyCMSError is raised.

If an error occurs while trying to obtain the description tag, a PyCMSError is raised

Use this function to obtain the information stored in the profile’s description tag.

Parameters:profile – EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile.
Returns:A string containing the internal profile information stored in an ICC tag.
Raises:PyCMSError
PIL.ImageCms.getProfileInfo(profile)

(pyCMS) Gets the internal product information for the given profile.

If profile isn’t a valid CmsProfile object or filename to a profile, a PyCMSError is raised.

If an error occurs while trying to obtain the info tag, a PyCMSError is raised

Use this function to obtain the information stored in the profile’s info tag. This often contains details about the profile, and how it was created, as supplied by the creator.

Parameters:profile – EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile.
Returns:A string containing the internal profile information stored in an ICC tag.
Raises:PyCMSError
PIL.ImageCms.getProfileManufacturer(profile)

(pyCMS) Gets the manufacturer for the given profile.

If profile isn’t a valid CmsProfile object or filename to a profile, a PyCMSError is raised.

If an error occurs while trying to obtain the manufacturer tag, a PyCMSError is raised

Use this function to obtain the information stored in the profile’s manufacturer tag.

Parameters:profile – EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile.
Returns:A string containing the internal profile information stored in an ICC tag.
Raises:PyCMSError
PIL.ImageCms.getProfileModel(profile)

(pyCMS) Gets the model for the given profile.

If profile isn’t a valid CmsProfile object or filename to a profile, a PyCMSError is raised.

If an error occurs while trying to obtain the model tag, a PyCMSError is raised

Use this function to obtain the information stored in the profile’s model tag.

Parameters:profile – EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile.
Returns:A string containing the internal profile information stored in an ICC tag.
Raises:PyCMSError
PIL.ImageCms.getProfileName(profile)

(pyCMS) Gets the internal product name for the given profile.

If profile isn’t a valid CmsProfile object or filename to a profile, a PyCMSError is raised If an error occurs while trying to obtain the name tag, a PyCMSError is raised.

Use this function to obtain the INTERNAL name of the profile (stored in an ICC tag in the profile itself), usually the one used when the profile was originally created. Sometimes this tag also contains additional information supplied by the creator.

Parameters:profile – EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile.
Returns:A string containing the internal name of the profile as stored in an ICC tag.
Raises:PyCMSError
PIL.ImageCms.get_display_profile(handle=None)

(experimental) Fetches the profile for the current display device. :returns: None if the profile is not known.

PIL.ImageCms.isIntentSupported(profile, intent, direction)

(pyCMS) Checks if a given intent is supported.

Use this function to verify that you can use your desired renderingIntent with profile, and that profile can be used for the input/output/proof profile as you desire.

Some profiles are created specifically for one “direction”, can cannot be used for others. Some profiles can only be used for certain rendering intents... so it’s best to either verify this before trying to create a transform with them (using this function), or catch the potential PyCMSError that will occur if they don’t support the modes you select.

Parameters:
  • profile – EITHER a valid CmsProfile object, OR a string of the filename of an ICC profile.
  • intent

    Integer (0-3) specifying the rendering intent you wish to use with this profile

    INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL) INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC) INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION) INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)
    see the pyCMS documentation for details on rendering intents and what
    they do.
  • direction

    Integer specifying if the profile is to be used for input, output, or proof

    INPUT = 0 (or use ImageCms.DIRECTION_INPUT) OUTPUT = 1 (or use ImageCms.DIRECTION_OUTPUT) PROOF = 2 (or use ImageCms.DIRECTION_PROOF)
Returns:

1 if the intent/direction are supported, -1 if they are not.

Raises:

PyCMSError

PIL.ImageCms.profileToProfile(im, inputProfile, outputProfile, renderingIntent=0, outputMode=None, inPlace=0, flags=0)

(pyCMS) Applies an ICC transformation to a given image, mapping from inputProfile to outputProfile.

If the input or output profiles specified are not valid filenames, a PyCMSError will be raised. If inPlace == TRUE and outputMode != im.mode, a PyCMSError will be raised. If an error occurs during application of the profiles, a PyCMSError will be raised. If outputMode is not a mode supported by the outputProfile (or by pyCMS), a PyCMSError will be raised.

This function applies an ICC transformation to im from inputProfile’s color space to outputProfile’s color space using the specified rendering intent to decide how to handle out-of-gamut colors.

OutputMode can be used to specify that a color mode conversion is to be done using these profiles, but the specified profiles must be able to handle that mode. I.e., if converting im from RGB to CMYK using profiles, the input profile must handle RGB data, and the output profile must handle CMYK data.

Parameters:
  • im – An open PIL image object (i.e. Image.new(...) or Image.open(...), etc.)
  • inputProfile – String, as a valid filename path to the ICC input profile you wish to use for this image, or a profile object
  • outputProfile – String, as a valid filename path to the ICC output profile you wish to use for this image, or a profile object
  • renderingIntent

    Integer (0-3) specifying the rendering intent you wish to use for the transform

    INTENT_PERCEPTUAL = 0 (DEFAULT) (ImageCms.INTENT_PERCEPTUAL) INTENT_RELATIVE_COLORIMETRIC = 1 (ImageCms.INTENT_RELATIVE_COLORIMETRIC) INTENT_SATURATION = 2 (ImageCms.INTENT_SATURATION) INTENT_ABSOLUTE_COLORIMETRIC = 3 (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC)

    see the pyCMS documentation for details on rendering intents and what they do.

  • outputMode – A valid PIL mode for the output image (i.e. “RGB”, “CMYK”, etc.). Note: if rendering the image “inPlace”, outputMode MUST be the same mode as the input, or omitted completely. If omitted, the outputMode will be the same as the mode of the input image (im.mode)
  • inPlace – Boolean (1 = True, None or 0 = False). If True, the original image is modified in-place, and None is returned. If False (default), a new Image object is returned with the transform applied.
  • flags – Integer (0-...) specifying additional flags
Returns:

Either None or a new PIL image object, depending on value of inPlace

Raises:

PyCMSError

PIL.ImageCms.versions()

(pyCMS) Fetches versions.

CmsProfile

The ICC color profiles are wrapped in an instance of the class CmsProfile. The specification ICC.1:2010 contains more information about the meaning of the values in ICC profiles.

For convenience, all XYZ-values are also given as xyY-values (so they can be easily displayed in a chromaticity diagram, for example).

class PIL.ImageCms.CmsProfile
creation_date

Date and time this profile was first created (see 7.2.1 of ICC.1:2010).

Type:datetime.datetime or None
version

The version number of the ICC standard that this profile follows (e.g. 2.0).

Type:float
icc_version

Same as version, but in encoded format (see 7.2.4 of ICC.1:2010).

device_class

4-character string identifying the profile class. One of scnr, mntr, prtr, link, spac, abst, nmcl (see 7.2.5 of ICC.1:2010 for details).

Type:string
xcolor_space

4-character string (padded with whitespace) identifying the color space, e.g. XYZ␣, RGB␣ or CMYK (see 7.2.6 of ICC.1:2010 for details).

Note that the deprecated attribute color_space contains an interpreted (non-padded) variant of this (but can be empty on unknown input).

Type:string
connection_space

4-character string (padded with whitespace) identifying the color space on the B-side of the transform (see 7.2.7 of ICC.1:2010 for details).

Note that the deprecated attribute pcs contains an interpreted (non-padded) variant of this (but can be empty on unknown input).

Type:string
header_flags

The encoded header flags of the profile (see 7.2.11 of ICC.1:2010 for details).

Type:int
header_manufacturer

4-character string (padded with whitespace) identifying the device manufacturer, which shall match the signature contained in the appropriate section of the ICC signature registry found at www.color.org (see 7.2.12 of ICC.1:2010).

Type:string
header_model

4-character string (padded with whitespace) identifying the device model, which shall match the signature contained in the appropriate section of the ICC signature registry found at www.color.org (see 7.2.13 of ICC.1:2010).

Type:string
attributes

Flags used to identify attributes unique to the particular device setup for which the profile is applicable (see 7.2.14 of ICC.1:2010 for details).

Type:int
rendering_intent

The rendering intent to use when combining this profile with another profile (usually overridden at run-time, but provided here for DeviceLink and embedded source profiles, see 7.2.15 of ICC.1:2010).

One of ImageCms.INTENT_ABSOLUTE_COLORIMETRIC, ImageCms.INTENT_PERCEPTUAL, ImageCms.INTENT_RELATIVE_COLORIMETRIC and ImageCms.INTENT_SATURATION.

Type:int
profile_id

A sequence of 16 bytes identifying the profile (via a specially constructed MD5 sum), or 16 binary zeroes if the profile ID has not been calculated (see 7.2.18 of ICC.1:2010).

Type:bytes
copyright

The text copyright information for the profile (see 9.2.21 of ICC.1:2010).

Type:unicode or None
manufacturer

The (english) display string for the device manufacturer (see 9.2.22 of ICC.1:2010).

Type:unicode or None
model

The (english) display string for the device model of the device for which this profile is created (see 9.2.23 of ICC.1:2010).

Type:unicode or None
profile_description

The (english) display string for the profile description (see 9.2.41 of ICC.1:2010).

Type:unicode or None
target

The name of the registered characterization data set, or the measurement data for a characterization target (see 9.2.14 of ICC.1:2010).

Type:unicode or None
red_colorant

The first column in the matrix used in matrix/TRC transforms (see 9.2.44 of ICC.1:2010).

Type:((X, Y, Z), (x, y, Y)) or None
green_colorant

The second column in the matrix used in matrix/TRC transforms (see 9.2.30 of ICC.1:2010).

Type:((X, Y, Z), (x, y, Y)) or None
blue_colorant

The third column in the matrix used in matrix/TRC transforms (see 9.2.4 of ICC.1:2010).

Type:((X, Y, Z), (x, y, Y)) or None
luminance

The absolute luminance of emissive devices in candelas per square metre as described by the Y channel (see 9.2.32 of ICC.1:2010).

Type:((X, Y, Z), (x, y, Y)) or None
chromaticity

The data of the phosphor/colorant chromaticity set used (red, green and blue channels, see 9.2.16 of ICC.1:2010).

Type:((x, y, Y), (x, y, Y), (x, y, Y)) or None
chromatic_adaption

The chromatic adaption matrix converts a color measured using the actual illumination conditions and relative to the actual adopted white, to an color relative to the PCS adopted white, with complete adaptation from the actual adopted white chromaticity to the PCS adopted white chromaticity (see 9.2.15 of ICC.1:2010).

Two matrices are returned, one in (X, Y, Z) space and one in (x, y, Y) space.

Type:2-tuple of 3-tuple, the first with (X, Y, Z) and the second with (x, y, Y) values
colorant_table

This tag identifies the colorants used in the profile by a unique name and set of PCSXYZ or PCSLAB values (see 9.2.19 of ICC.1:2010).

Type:list of strings
colorant_table_out

This tag identifies the colorants used in the profile by a unique name and set of PCSLAB values (for DeviceLink profiles only, see 9.2.19 of ICC.1:2010).

Type:list of strings
colorimetric_intent

4-character string (padded with whitespace) identifying the image state of PCS colorimetry produced using the colorimetric intent transforms (see 9.2.20 of ICC.1:2010 for details).

Type:string or None
perceptual_rendering_intent_gamut

4-character string (padded with whitespace) identifying the (one) standard reference medium gamut (see 9.2.37 of ICC.1:2010 for details).

Type:string or None
saturation_rendering_intent_gamut

4-character string (padded with whitespace) identifying the (one) standard reference medium gamut (see 9.2.37 of ICC.1:2010 for details).

Type:string or None
technology

4-character string (padded with whitespace) identifying the device technology (see 9.2.47 of ICC.1:2010 for details).

Type:string or None
media_black_point

This tag specifies the media black point and is used for generating absolute colorimetry.

This tag was available in ICC 3.2, but it is removed from version 4.

Type:((X, Y, Z), (x, y, Y)) or None
media_white_point_temperature

Calculates the white point temperature (see the LCMS documentation for more information).

Type:float or None
viewing_condition

The (english) display string for the viewing conditions (see 9.2.48 of ICC.1:2010).

Type:unicode or None
screening_description

The (english) display string for the screening conditions.

This tag was available in ICC 3.2, but it is removed from version 4.

Type:unicode or None
red_primary

The XYZ-transformed of the RGB primary color red (1, 0, 0).

Type:((X, Y, Z), (x, y, Y)) or None
green_primary

The XYZ-transformed of the RGB primary color green (0, 1, 0).

Type:((X, Y, Z), (x, y, Y)) or None
blue_primary

The XYZ-transformed of the RGB primary color blue (0, 0, 1).

Type:((X, Y, Z), (x, y, Y)) or None
is_matrix_shaper

True if this profile is implemented as a matrix shaper (see documentation on LCMS).

Type:bool
clut

Returns a dictionary of all supported intents and directions for the CLUT model.

The dictionary is indexed by intents (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC, ImageCms.INTENT_PERCEPTUAL, ImageCms.INTENT_RELATIVE_COLORIMETRIC and ImageCms.INTENT_SATURATION).

The values are 3-tuples indexed by directions (ImageCms.DIRECTION_INPUT, ImageCms.DIRECTION_OUTPUT, ImageCms.DIRECTION_PROOF).

The elements of the tuple are booleans. If the value is True, that intent is supported for that direction.

Type:dict of boolean 3-tuples
intent_supported

Returns a dictionary of all supported intents and directions.

The dictionary is indexed by intents (ImageCms.INTENT_ABSOLUTE_COLORIMETRIC, ImageCms.INTENT_PERCEPTUAL, ImageCms.INTENT_RELATIVE_COLORIMETRIC and ImageCms.INTENT_SATURATION).

The values are 3-tuples indexed by directions (ImageCms.DIRECTION_INPUT, ImageCms.DIRECTION_OUTPUT, ImageCms.DIRECTION_PROOF).

The elements of the tuple are booleans. If the value is True, that intent is supported for that direction.

Type:dict of boolean 3-tuples
color_space

Deprecated but retained for backwards compatibility. Interpreted value of xcolor_space. May be the empty string if value could not be decoded.

Type:string
pcs

Deprecated but retained for backwards compatibility. Interpreted value of connection_space. May be the empty string if value could not be decoded.

Type:string
product_model

Deprecated but retained for backwards compatibility. ASCII-encoded value of model.

Type:string
product_manufacturer

Deprecated but retained for backwards compatibility. ASCII-encoded value of manufacturer.

Type:string

Deprecated but retained for backwards compatibility. ASCII-encoded value of copyright.

Type:string
product_description

Deprecated but retained for backwards compatibility. ASCII-encoded value of profile_description.

Type:string
product_desc

Deprecated but retained for backwards compatibility. ASCII-encoded value of profile_description.

This alias of product_description used to contain a derived informative string about the profile, depending on the value of the description, copyright, manufacturer and model fields).

Type:string

There is one function defined on the class:

is_intent_supported(intent, direction)

Returns if the intent is supported for the given direction.

Note that you can also get this information for all intents and directions with intent_supported.

Parameters:
  • intent – One of ImageCms.INTENT_ABSOLUTE_COLORIMETRIC, ImageCms.INTENT_PERCEPTUAL, ImageCms.INTENT_RELATIVE_COLORIMETRIC and ImageCms.INTENT_SATURATION.
  • direction – One of ImageCms.DIRECTION_INPUT, ImageCms.DIRECTION_OUTPUT and ImageCms.DIRECTION_PROOF
Returns:

Boolean if the intent and direction is supported.