Function jpegxl_sys::JxlDecoderGetColorAsEncodedProfile[][src]

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

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 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 and you must use JxlDecoderGetColorAsICCProfile 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 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, JxlDecoderGetColorAsICCProfile is not available.

If you wish to render the image using a system that supports ICC profiles, use JxlDecoderGetColorAsICCProfile first. If you’re looking for a specific color space possibly indicated in the JPEG XL image, use JxlDecoderGetColorAsEncodedProfile first.

@param dec decoder object @param format pixel format to output the data to. Only used for 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 JXL_DEC_SUCCESS if the data is available and returned, JXL_DEC_NEED_MORE_INPUT if not yet available, JXL_DEC_ERROR in case the encuded structured color profile does not exist in the codestream.