From 32e397679749632d2fe65450b2fb20493a8e23e7 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sun, 8 Oct 2023 22:02:54 +0800 Subject: [PATCH] fix: support RGBA16 images --- adaptor/src/image.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) });