Skip to content

Commit

Permalink
fix conversion of GIF -> WebP by adding image coalescing
Browse files Browse the repository at this point in the history
  • Loading branch information
walterbm committed May 16, 2023
1 parent 1cdbd88 commit 83e650b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ futures-util = "0.3.21"
httpdate = "1.0.2"
image = "0.24.6"
log = "0.4.17"
magick_rust = { version = "0.18.0", features = ["disable-hdri"] }
magick_rust = { git = "https://github.com/walterbm/magick-rust.git", branch = "add-support-for-coalesce", features = [
"disable-hdri"
] }
openssl = "0.10.52"
pin-project-lite = "0.2"
rand = "0.8.5"
Expand Down
4 changes: 4 additions & 0 deletions src/img/resizable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ impl ResizableImage {
quality: u8,
format: ImageFormat,
) -> Result<Vec<u8>, ImageError> {
if self.wand.get_image_scene() > 0 {
self.wand.coalesce().map_err(|_| ImageError::FailedWrite)?;
}

self.wand
.strip_image()
.map_err(|_| ImageError::FailedWrite)?;
Expand Down

0 comments on commit 83e650b

Please sign in to comment.