fix: support RGBA16 images (#250)

This commit is contained in:
三咲雅 · Misaki Masa 2023-10-08 22:13:56 +08:00 committed by GitHub
parent f4a8b26a5a
commit baeb009fa0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
});