webp icon indicating copy to clipboard operation
webp copied to clipboard

ICC Profile

Open neckaros opened this issue 11 months ago • 3 comments

Is there a way like for Encoder of the Image crate to embed an ICC profile in the encoder?

    /// Set the ICC profile to use for the image.
    ///
    /// This function is a no-op for formats that don't support ICC profiles.
    /// For formats that do support ICC profiles, the profile will be embedded
    /// in the image when it is saved.
    ///
    /// # Errors
    ///
    /// This function returns an error if the format does not support ICC profiles.
    fn set_icc_profile(&mut self, icc_profile: Vec<u8>) -> Result<(), UnsupportedError> {
        let _ = icc_profile;
        Err(UnsupportedError::from_format_and_kind(
            ImageFormatHint::Unknown,
            UnsupportedErrorKind::GenericFeature(
                "ICC profiles are not supported for this format".into(),
            ),
        ))
    }

WebP Specification: https://developers.google.com/speed/webp/docs/riff_container

Color Profile: Chunk Size bytes ICC profile. This chunk MUST appear before the image data.

There SHOULD be at most one such chunk. If there are more such chunks, readers MAY ignore all except the first one. See the ICC Specification for details.

If this chunk is not present, sRGB SHOULD be assumed.

neckaros avatar Jan 24 '25 16:01 neckaros