Skip to content

Commit

Permalink
use new_lossless(); lossy is not yet supported in WebPEncoder
Browse files Browse the repository at this point in the history
  • Loading branch information
gfx committed May 24, 2024
1 parent 6464003 commit 1284f29
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,10 @@ fn adjust_size_of_image(
max_size: usize,
) -> Result<Bytes, Box<dyn std::error::Error>> {
let image = image::load_from_memory(&blob)?.into_rgba8();

// try to re-encode the image to lossless WebP in any ways.
blob = {
let mut out = std::io::BufWriter::new(Vec::new());
WebPEncoder::new_with_quality(&mut out, WebPQuality::lossless()).write_image(
WebPEncoder::new_lossless(&mut out).write_image(
&image,
image.width(),
image.height(),
Expand Down

0 comments on commit 1284f29

Please sign in to comment.