Skip to content

Commit

Permalink
fix(turbopack-image): fix build error (#5207)
Browse files Browse the repository at this point in the history
### Description

enabling webp never actually able to build.
  • Loading branch information
kwonoj authored Jun 5, 2023
1 parent 4e99d40 commit c2f7a80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions crates/turbopack-image/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ autobenches = false
bench = false

[features]

# [NOTE]: Before enable this, ensure this can build all of the target platforms we support.
avif = ["image/avif-decoder", "image/avif-encoder"]
webp = ["image/webp", "image/webp-encoder"]
Expand Down
15 changes: 7 additions & 8 deletions crates/turbopack-image/src/process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,13 @@ fn encode_image(image: DynamicImage, format: ImageFormat, quality: u8) -> Result
}
#[cfg(feature = "webp")]
ImageFormat::WebP => {
use image::webp::{WebPEncoder, WebPQuality};
WebPEncoder::new_with_quality(&mut buf, WebPQuality::lossy(options.quality))
.write_image(
small_image.as_bytes(),
blur_width,
blur_height,
small_image.color(),
)?;
use image::codecs::webp::{WebPEncoder, WebPQuality};
WebPEncoder::new_with_quality(&mut buf, WebPQuality::lossy(quality)).write_image(
image.as_bytes(),
width,
height,
image.color(),
)?;
(buf, Mime::from_str("image/webp")?)
}
#[cfg(feature = "avif")]
Expand Down

0 comments on commit c2f7a80

Please sign in to comment.