Skip to content

Commit

Permalink
fix: support RGBA16 images (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi authored Oct 8, 2023
1 parent f4a8b26 commit baeb009
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion adaptor/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
});

Expand Down

0 comments on commit baeb009

Please sign in to comment.