JxlDecoderSetOutputColorProfile

Function JxlDecoderSetOutputColorProfile 

Source
pub unsafe extern "C-unwind" fn JxlDecoderSetOutputColorProfile(
    dec: *mut JxlDecoder,
    color_encoding: *const JxlColorEncoding,
    icc_data: *const u8,
    icc_size: usize,
) -> JxlDecoderStatus
Expand description

Sets the desired output color profile of the decoded image either from a color encoding or an ICC profile. Valid calls of this function have either color_encoding or icc_data set to NULL and icc_size must be 0 if and only if icc_data is NULL.

Depending on whether a color management system (CMS) has been set the behavior is as follows:

If a color management system (CMS) has been set with JxlDecoderSetCms, and the CMS supports output to the desired color encoding or ICC profile, then it will provide the output in that color encoding or ICC profile. If the desired color encoding or the ICC is not supported, then an error will be returned.

If no CMS has been set with JxlDecoderSetCms, there are two cases:

  1. Calling this function with a color encoding will convert XYB images to the desired color encoding. In this case, if the requested color encoding has a narrower gamut, or the white points differ, then the resulting image can have significant color distortion. Non-XYB images will not be converted to the desired color space.

  2. Calling this function with an ICC profile will result in an error.

If called with an ICC profile (after a call to JxlDecoderSetCms), the ICC profile has to be a valid RGB or grayscale color profile.

Can only be set after the JxlDecoderStatus::ColorEncoding event occurred and before any other event occurred, and should be used before getting JxlColorProfileTarget::Data.

This function must not be called before JxlDecoderSetCms.

§Parameters

  • dec: decoder object
  • color_encoding: the output color encoding
  • icc_data: bytes of the icc profile
  • icc_size: size of the icc profile in bytes

§Returns