Skip to content

Commit

Permalink
fix: make set_icc_profile function available
Browse files Browse the repository at this point in the history
  • Loading branch information
misl-smlz committed Oct 4, 2024
1 parent 98ceb71 commit a8d10cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/codecs/webp/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ impl<W: Write> ImageEncoder for WebPEncoder<W> {
) -> ImageResult<()> {
self.encode(buf, width, height, color_type)
}

fn set_icc_profile(&mut self, icc_profile: Vec<u8>) -> Result<(), UnsupportedError> {
self.inner.set_icc_profile(icc_profile);
Ok(())
}
}

impl ImageError {
Expand Down
15 changes: 15 additions & 0 deletions src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<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(),
),
))
}
}

/// Immutable pixel iterator
Expand Down

0 comments on commit a8d10cc

Please sign in to comment.