Skip to content

Commit

Permalink
Bump jpegxl-rs to 0.10.3 and use set_jpeg_quality.
Browse files Browse the repository at this point in the history
  • Loading branch information
veluca93 committed May 4, 2024
1 parent e401350 commit c4464d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 1 addition & 9 deletions components/imageproc/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,7 @@ impl ImageOp {
encoder.uses_original_profile(true);
encoder.lossless(true);
} else {
// TODO(veluca93): replace with set_jpeg_quality once
// https://github.com/inflation/jpegxl-rs/pull/48 is in and released.
// See `JxlEncoderDistanceFromQuality` for the formula.
let distance = if q >= 30 {
0.1 + (100 - q) as f32 * 0.09
} else {
53.0 / 3000.0 * (q as f32 * q as f32) - 23.0 / 20.0 * q as f32 + 25.0
};
encoder.quality(distance);
encoder.set_jpeg_quality(q as f32);
}
} else {
encoder.uses_original_profile(true);
Expand Down
2 changes: 1 addition & 1 deletion components/libs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ unicode-segmentation = "1.2"
url = "2"
walkdir = "2"
webp = "0.2"
jpegxl-rs = { version = "0.10.2", default-features = false, features = ["vendored"] }
jpegxl-rs = { version = "0.10.3", default-features = false, features = ["vendored"] }


[features]
Expand Down

0 comments on commit c4464d4

Please sign in to comment.