diff --git a/adaptor/src/image.rs b/adaptor/src/image.rs index 871c1248..b4380362 100644 --- a/adaptor/src/image.rs +++ b/adaptor/src/image.rs @@ -40,7 +40,12 @@ impl Image { return Ok(false); } - img.resize(w, h, FilterType::Triangle).save_with_format(cache, ImageFormat::Jpeg)?; + match img.resize(w, h, FilterType::Triangle) { + DynamicImage::ImageRgb8(buf) => buf.save_with_format(cache, ImageFormat::Jpeg), + DynamicImage::ImageRgba8(buf) => buf.save_with_format(cache, ImageFormat::Jpeg), + buf => buf.to_rgb8().save_with_format(cache, ImageFormat::Jpeg), + }?; + Ok(true) });