pub unsafe extern "C" fn JxlDecoderGetColorAsEncodedProfile(
    dec: *const JxlDecoder,
    format: *const JxlPixelFormat,
    target: JxlColorProfileTarget,
    color_encoding: *mut JxlColorEncoding
) -> JxlDecoderStatus
Expand description

Outputs the color profile as JPEG XL encoded structured data, if available. This is an alternative to an ICC Profile, which can represent a more limited amount of color spaces, but represents them exactly through enum values.

It is often possible to use @ref JxlDecoderGetColorAsICCProfile as an alternative anyway. The following scenarios are possible:

  • The JPEG XL image has an attached ICC Profile, in that case, the encoded structured data is not available, this function will return an error status. @ref JxlDecoderGetColorAsICCProfile should be called instead.
  • The JPEG XL image has an encoded structured color profile, and it represents an RGB or grayscale color space. This function will return it. You can still use @ref JxlDecoderGetColorAsICCProfile as well as an alternative if desired, though depending on which RGB color space is represented, the ICC profile may be a close approximation. It is also not always feasible to deduce from an ICC profile which named color space it exactly represents, if any, as it can represent any arbitrary space.
  • The JPEG XL image has an encoded structured color profile, and it indicates an unknown or xyb color space. In that case, @ref JxlDecoderGetColorAsICCProfile is not available.

When rendering an image on a system that supports ICC profiles, @ref JxlDecoderGetColorAsICCProfile should be used first. When rendering for a specific color space, possibly indicated in the JPEG XL image, @ref JxlDecoderGetColorAsEncodedProfile should be used first.

@param dec decoder object @param format pixel format to output the data to. Only used for @ref JXL_COLOR_PROFILE_TARGET_DATA, may be nullptr otherwise. @param target whether to get the original color profile from the metadata or the color profile of the decoded pixels. @param color_encoding struct to copy the information into, or NULL to only check whether the information is available through the return value. @return @ref JXL_DEC_SUCCESS if the data is available and returned, @ref JXL_DEC_NEED_MORE_INPUT if not yet available, @ref JXL_DEC_ERROR in case the encoded structured color profile does not exist in the codestream.