Skip to content

Commit 06bc64a

Browse files
committed
Revert back into universal WebP conversion
1 parent 0f22231 commit 06bc64a

File tree

1 file changed

+6
-27
lines changed

1 file changed

+6
-27
lines changed

apps/labrinth/src/util/img.rs

+6-27
Original file line numberDiff line numberDiff line change
@@ -124,33 +124,12 @@ fn process_image(
124124
min_aspect_ratio: Option<f32>,
125125
) -> Result<(bytes::Bytes, String), ImageError> {
126126
match content_type {
127-
"image/gif" => {
128-
if target_width.is_none() && min_aspect_ratio.is_none() {
129-
process_animated_image(
130-
image_bytes,
131-
content_type,
132-
target_width,
133-
min_aspect_ratio,
134-
)
135-
} else {
136-
// Skip animated image processing for GIFs that won't be modified
137-
// But not before checking if it's indeed a GIF
138-
let format = image::guess_format(&image_bytes)?;
139-
if format == ImageFormat::Gif {
140-
Ok((image_bytes.clone(), "gif".to_string()))
141-
} else {
142-
Err(ImageError::Unsupported(
143-
UnsupportedError::from_format_and_kind(
144-
ImageFormat::Gif.into(),
145-
UnsupportedErrorKind::GenericFeature(
146-
"Attempted to process an invalid GIF!"
147-
.to_owned()
148-
),
149-
),
150-
))
151-
}
152-
}
153-
}
127+
"image/gif" => process_animated_image(
128+
image_bytes,
129+
content_type,
130+
target_width,
131+
min_aspect_ratio,
132+
),
154133
"image/png" => {
155134
let decoder = PngDecoder::new(Cursor::new(image_bytes.clone()))?;
156135
if decoder.is_apng()? {

0 commit comments

Comments
 (0)