decoder: Bring back support for still WebP images

We manually have to use the static decoder instead of
the frames api as for PNG.

Issue #115
This commit is contained in:
Sophie Herold 2023-04-06 21:45:56 +02:00 • committed by Christopher Davis
parent 65e967c235
commit ca672552be

View file

@ -125,10 +125,16 @@ impl ImageRsOther {
image_rs::codecs::gif::GifDecoder::new(file)?.into_frames(),
ImageFormat::AnimatedGif,
),
image_rs::ImageFormat::WebP => (
image_rs::codecs::webp::WebPDecoder::new(file)?.into_frames(),
ImageFormat::AnimatedWebP,
),
image_rs::ImageFormat::WebP => {
let decoder = image_rs::codecs::webp::WebPDecoder::new(file)?;
if decoder.has_animation() {
(decoder.into_frames(), ImageFormat::AnimatedWebP)
} else {
// Static WebP images need a different decoder
Self::new_static(path, format, updater, tiles);
return Ok(());
}
}
image_rs::ImageFormat::Png => {
let decoder = image_rs::codecs::png::PngDecoder::new(file)?;
if decoder.is_apng() {