diff --git a/src/codecs/webp/encoder.rs b/src/codecs/webp/encoder.rs index dfdfbead01..422a36b795 100644 --- a/src/codecs/webp/encoder.rs +++ b/src/codecs/webp/encoder.rs @@ -92,6 +92,11 @@ impl ImageEncoder for WebPEncoder { ) -> ImageResult<()> { self.encode(buf, width, height, color_type) } + + fn set_icc_profile(&mut self, icc_profile: Vec) -> Result<(), UnsupportedError> { + self.inner.set_icc_profile(icc_profile); + Ok(()) + } } impl ImageError { diff --git a/src/image.rs b/src/image.rs index 06a5953e41..59ae08bc6e 100644 --- a/src/image.rs +++ b/src/image.rs @@ -787,6 +787,21 @@ pub trait ImageEncoder { height: u32, color_type: ExtendedColorType, ) -> ImageResult<()>; + + /// Set the ICC profile to use for the image. + /// + /// # Panics + /// + /// Panics if the ICC profile is not implemented for the format. + fn set_icc_profile(&mut self, icc_profile: Vec) -> Result<(), UnsupportedError> { + let _ = icc_profile; + Err(UnsupportedError::from_format_and_kind( + ImageFormatHint::Unknown, + UnsupportedErrorKind::GenericFeature( + "ICC profiles are not supported for this format".into(), + ), + )) + } } /// Immutable pixel iterator