GimpColorProfile: GIMP Color Library Reference Manual

## GimpColorProfile GimpColorProfile — Definitions and Functions relating to LCMS. |

## Functions

GimpColorProfile * | gimp_color_profile_new_rgb_srgb ()
GimpColorProfile * | gimp_color_profile_new_rgb_srgb_linear ()
GimpColorProfile * | gimp_color_profile_new_rgb_adobe ()
GimpColorProfile * | gimp_color_profile_new_d65_gray_srgb_trc ()
GimpColorProfile * | gimp_color_profile_new_d65_gray_linear ()
GimpColorProfile * | gimp_color_profile_new_d50_gray_lab_trc ()
GimpColorProfile * | gimp_color_profile_new_srgb_trc_from_color_profile ()
GimpColorProfile * | gimp_color_profile_new_linear_from_color_profile ()
GimpColorProfile * | gimp_color_profile_new_from_file ()
GimpColorProfile * | gimp_color_profile_new_from_icc_profile ()
GimpColorProfile * | gimp_color_profile_new_from_lcms_profile ()
gboolean | gimp_color_profile_save_to_file ()
const guint8 * | gimp_color_profile_get_icc_profile ()
gpointer | gimp_color_profile_get_lcms_profile ()
const gchar * | gimp_color_profile_get_description ()
const gchar * | gimp_color_profile_get_manufacturer ()
const gchar * | gimp_color_profile_get_model ()
const gchar * | gimp_color_profile_get_copyright ()
const gchar * | gimp_color_profile_get_label ()
const gchar * | gimp_color_profile_get_summary ()
gboolean | gimp_color_profile_is_equal ()
gboolean | gimp_color_profile_is_rgb ()
gboolean | gimp_color_profile_is_gray ()
gboolean | gimp_color_profile_is_cmyk ()
gboolean | gimp_color_profile_is_linear ()
const Babl * | gimp_color_profile_get_space ()
const Babl * | gimp_color_profile_get_format ()
const Babl * | gimp_color_profile_get_lcms_format ()

## Description

Definitions and Functions relating to LCMS.

## Functions

### gimp_color_profile_new_rgb_srgb ()

    GimpColorProfile *
    gimp_color_profile_new_rgb_srgb (void);

This function is a replacement for `cmsCreate_sRGBProfile()` and returns an sRGB profile that is functionally the same as the ArgyllCMS sRGB.icm profile. "Functionally the same" means it has the same red, green, and blue colorants and the V4 "chad" equivalent of the ArgyllCMS V2 white point. The profile TRC is also functionally equivalent to the ArgyllCMS sRGB.icm TRC and is the same as the LCMS sRGB built-in profile TRC.

The actual primaries in the sRGB specification are red xy: {0.6400, 0.3300, 1.0} green xy: {0.3000, 0.6000, 1.0} blue xy: {0.1500, 0.0600, 1.0}

The sRGB primaries given below are "pre-quantized" to compensate for hexadecimal quantization during the profile-making process. Unless the profile-making code compensates for this quantization, the resulting profile's red, green, and blue colorants will deviate slightly from the correct XYZ values.

LCMS2 doesn't compensate for hexadecimal quantization. The "pre-quantized" primaries below were back-calculated from the ArgyllCMS sRGB.icm profile. The resulting sRGB profile's colorants exactly matches the ArgyllCMS sRGB.icm profile colorants.

#### Returns

the sRGB GimpColorProfile.

Since: 2.10

### gimp_color_profile_new_rgb_srgb_linear ()

    GimpColorProfile *
    gimp_color_profile_new_rgb_srgb_linear
                                   (void);

This function creates a profile for babl_model("RGB"). Please somebody write something smarter here.

#### Returns

the linear RGB GimpColorProfile.

Since: 2.10

### gimp_color_profile_new_rgb_adobe ()

    GimpColorProfile *
    gimp_color_profile_new_rgb_adobe (void);

This function creates a profile compatible with AbobeRGB (1998).

#### Returns

the AdobeRGB-compatible GimpColorProfile.

Since: 2.10

### gimp_color_profile_new_d65_gray_srgb_trc ()

    GimpColorProfile *
    gimp_color_profile_new_d65_gray_srgb_trc
                                   (void);

This function creates a grayscale GimpColorProfile with an sRGB TRC. See `gimp_color_profile_new_rgb_srgb()`.

#### Returns

the sRGB-gamma grayscale GimpColorProfile.

Since: 2.10

### gimp_color_profile_new_d65_gray_linear ()

    GimpColorProfile *
    gimp_color_profile_new_d65_gray_linear
                                   (void);

### gimp_color_profile_new_d50_gray_lab_trc ()

    GimpColorProfile *
    gimp_color_profile_new_d50_gray_lab_trc
                                   (void);

This function creates a grayscale GimpColorProfile with the D50 ICC profile illuminant as the profile white point and the LAB companding curve as the TRC.

#### Returns

a gray profile with the D50 ICC profile illuminant as the profile white point and the LAB companding curve as the TRC. as the TRC.

Since: 2.10

### gimp_color_profile_new_srgb_trc_from_color_profile ()

    GimpColorProfile *
    gimp_color_profile_new_srgb_trc_from_color_profile
                                   (GimpColorProfile *profile);

This function creates a new RGB GimpColorProfile with a sRGB gamma TRC and `profile` 's RGB chromacities and whitepoint.

#### Parameters

profile | a GimpColorProfile |

#### Returns

the new GimpColorProfile, or `NULL` if `profile` is not an RGB profile or not matrix-based.

Since: 2.10

### gimp_color_profile_new_linear_from_color_profile ()

    GimpColorProfile *
    gimp_color_profile_new_linear_from_color_profile
                                   (GimpColorProfile *profile);

This function creates a new RGB GimpColorProfile with a linear TRC and `profile` 's RGB chromacities and whitepoint.

#### Parameters

profile | a GimpColorProfile |

#### Returns

the new GimpColorProfile, or `NULL` if `profile` is not an RGB profile or not matrix-based.

Since: 2.10

### gimp_color_profile_new_from_file ()

    GimpColorProfile *
    gimp_color_profile_new_from_file (GFile *file,
                                      GError **error);

This function opens an ICC color profile from `file` .

#### Parameters

file | a GFile |
error | return location for GError |

#### Returns

the GimpColorProfile, or `NULL`. On error, `NULL` is returned and `error` is set.

Since: 2.10

### gimp_color_profile_new_from_icc_profile ()

    GimpColorProfile *
    gimp_color_profile_new_from_icc_profile
                                   (const guint8 *data,
                                    gsize length,
                                    GError **error);

This function opens an ICC color profile from memory. On error, `NULL` is returned and `error` is set.

#### Parameters

data | pointer to memory containing an ICC profile |
length | length of the profile in memory, in bytes |
error | return location for GError |

#### Returns

the GimpColorProfile, or `NULL`.

Since: 2.10

### gimp_color_profile_new_from_lcms_profile ()

    GimpColorProfile *
    gimp_color_profile_new_from_lcms_profile
                                   (gpointer lcms_profile,
                                    GError **error);

This function creates a GimpColorProfile from a cmsHPROFILE. On error, `NULL` is returned and `error` is set. The passed `lcms_profile` pointer is not retained by the created GimpColorProfile.

#### Parameters

lcms_profile | an LCMS cmsHPROFILE pointer |
error | return location for GError |

#### Returns

the GimpColorProfile, or `NULL`.

Since: 2.10

### gimp_color_profile_save_to_file ()

    gboolean
    gimp_color_profile_save_to_file (GimpColorProfile *profile,
                                     GFile *file,
                                     GError **error);

This function saves `profile` to `file` as ICC profile.

#### Parameters

profile | a GimpColorProfile |
file | a GFile |
error | return location for GError |

#### Returns

`TRUE` on success, `FALSE` if an error occurred.

Since: 2.10

### gimp_color_profile_get_icc_profile ()

    const guint8 *
    gimp_color_profile_get_icc_profile (GimpColorProfile *profile,
                                        gsize *length);

This function returns `profile` as ICC profile data. The returned memory belongs to `profile` and must not be modified or freed.

#### Parameters

profile | a GimpColorProfile |
length | return location for the number of bytes |

#### Returns

a pointer to the IIC profile data.

Since: 2.10

### gimp_color_profile_get_lcms_profile ()

    gpointer
    gimp_color_profile_get_lcms_profile (GimpColorProfile *profile);

This function returns `profile` 's cmsHPROFILE. The returned value belongs to `profile` and must not be modified or freed.

#### Parameters

profile | a GimpColorProfile |

#### Returns

a pointer to the cmsHPROFILE.

Since: 2.10

### gimp_color_profile_get_description ()

    const gchar *
    gimp_color_profile_get_description (GimpColorProfile *profile);

#### Parameters

profile | a GimpColorProfile |

#### Returns

a string containing `profile` 's description. The returned value belongs to `profile` and must not be modified or freed.

Since: 2.10

### gimp_color_profile_get_manufacturer ()

    const gchar *
    gimp_color_profile_get_manufacturer (GimpColorProfile *profile);

#### Parameters

profile | a GimpColorProfile |

#### Returns

a string containing `profile` 's manufacturer. The returned value belongs to `profile` and must not be modified or freed.

Since: 2.10

### gimp_color_profile_get_model ()

    const gchar *
    gimp_color_profile_get_model (GimpColorProfile *profile);

#### Parameters

profile | a GimpColorProfile |

#### Returns

a string containing `profile` 's model. The returned value belongs to `profile` and must not be modified or freed.

Since: 2.10

### gimp_color_profile_get_copyright ()

    const gchar *
    gimp_color_profile_get_copyright (GimpColorProfile *profile);

#### Parameters

profile | a GimpColorProfile |

#### Returns

a string containing `profile` 's copyright. The returned value belongs to `profile` and must not be modified or freed.

Since: 2.10

### gimp_color_profile_get_label ()

    const gchar *
    gimp_color_profile_get_label (GimpColorProfile *profile);

This function returns a string containing `profile` 's "title", a string that can be used to label the profile in a user interface.

Unlike `gimp_color_profile_get_description()`, this function always returns a string (as a fallback, it returns "(unnamed profile)").

#### Parameters

profile | a GimpColorProfile |

#### Returns

the `profile` 's label. The returned value belongs to `profile` and must not be modified or freed.

Since: 2.10

### gimp_color_profile_get_summary ()

    const gchar *
    gimp_color_profile_get_summary (GimpColorProfile *profile);

This function return a string containing a multi-line summary of `profile` 's description, model, manufacturer and copyright, to be used as detailed information about the profile in a user interface.

#### Parameters

profile | a GimpColorProfile |

#### Returns

the `profile` 's summary. The returned value belongs to `profile` and must not be modified or freed.

Since: 2.10

### gimp_color_profile_is_equal ()

    gboolean
    gimp_color_profile_is_equal (GimpColorProfile *profile1,
                                 GimpColorProfile *profile2);

Compares two profiles.

#### Parameters

profile1 | a GimpColorProfile |
profile2 | a GimpColorProfile |

#### Returns

`TRUE` if the profiles are equal, `FALSE` otherwise.

Since: 2.10

### gimp_color_profile_is_rgb ()

    gboolean
    gimp_color_profile_is_rgb (GimpColorProfile *profile);

#### Parameters

profile | a GimpColorProfile |

#### Returns

`TRUE` if the profile's color space is RGB, `FALSE` otherwise.

Since: 2.10

### gimp_color_profile_is_gray ()

    gboolean
    gimp_color_profile_is_gray (GimpColorProfile *profile);

#### Parameters

profile | a GimpColorProfile |

#### Returns

`TRUE` if the profile's color space is grayscale, `FALSE` otherwise.

Since: 2.10

### gimp_color_profile_is_cmyk ()

    gboolean
    gimp_color_profile_is_cmyk (GimpColorProfile *profile);

#### Parameters

profile | a GimpColorProfile |

#### Returns

`TRUE` if the profile's color space is CMYK, `FALSE` otherwise.

Since: 2.10

### gimp_color_profile_is_linear ()

    gboolean
    gimp_color_profile_is_linear (GimpColorProfile *profile);

This function determines is the ICC profile represented by a GimpColorProfile is a linear RGB profile or not, some profiles that are LUTs though linear will also return FALSE;

#### Parameters

profile | a GimpColorProfile |

#### Returns

`TRUE` if the profile is a matrix shaping profile with linear TRCs, `FALSE` otherwise.

Since: 2.10

### gimp_color_profile_get_space ()

    const Babl *
    gimp_color_profile_get_space (GimpColorProfile *profile,
                                  GimpColorRenderingIntent intent,
                                  GError **error);

This function returns the Babl space of `profile` , for the specified `intent` .

#### Parameters

profile | a GimpColorProfile |
intent | a GimpColorRenderingIntent |
error | return location for GError |

#### Returns

the new Babl space.

Since: 2.10.6

### gimp_color_profile_get_format ()

    const Babl *
    gimp_color_profile_get_format (GimpColorProfile *profile,
                                   const Babl *format,
                                   GimpColorRenderingIntent intent,
                                   GError **error);

This function takes a GimpColorProfile and a Babl format and returns a new Babl format with `profile` 's RGB primaries and TRC, and `format` 's pixel layout.

#### Parameters

profile | a GimpColorProfile |
format | a Babl format |
intent | a GimpColorRenderingIntent |
error | return location for GError |

#### Returns

the new Babl format.

Since: 2.10

### gimp_color_profile_get_lcms_format ()

    const Babl *
    gimp_color_profile_get_lcms_format (const Babl *format,
                                        guint32 *lcms_format);

This function takes a Babl format and returns the lcms format to be used with that `format` . It also returns a Babl format to be used instead of the passed `format` , which usually is the same as `format` , unless lcms doesn't support `format` .

Note that this function currently only supports RGB, RGBA, R'G'B', R'G'B'A, Y, YA, Y', Y'A and the cairo-RGB24 and cairo-ARGB32 formats.

#### Parameters

format | a Babl format |
lcms_format | return location for an lcms format |

#### Returns

the Babl format to be used instead of `format` , or `NULL` if the passed `format` is not supported at all.

Since: 2.10