Allow alpha in IFF compatibility encoder

This commit is contained in:
Dylan M. Taylor
2026-11-13 09:31:18 -05:00
parent 2db7c82705
commit 80b55dee5a
+2 -2
View File
@@ -9,8 +9,8 @@ pub fn decode(bytes: &[u8], limits: &Limits) -> Result<Image, CodecError> {
bridge::format(Format::Iff, bytes, limits)
}
pub fn encode(image: &Image) -> Result<Vec<u8>, CodecError> {
if image.layout() != crate::ChannelLayout::Rgb || image.sample_type() != crate::SampleType::U8 {
return Err(CodecError::encode("IFF", "ILBM writer stores 8-bit RGB pixels"));
if !matches!(image.layout(), crate::ChannelLayout::Rgb | crate::ChannelLayout::Rgba) || image.sample_type() != crate::SampleType::U8 {
return Err(CodecError::encode("IFF", "ILBM writer stores 8-bit RGB pixels with optional alpha"));
}
bridge::encode(image, Format::Iff, &Default::default())
}