fix: support RGBA16 images

This commit is contained in:
sxyazi 2023-10-08 22:02:54 +08:00
parent 4527044547
commit 32e3976797
No known key found for this signature in database

View file

@ -40,7 +40,12 @@ impl Image {
return Ok(false); 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) Ok(true)
}); });