Skip to content

Commit

Permalink
fix #6
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredforth committed May 11, 2021
1 parent 2f44192 commit 13d7ac8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ mod tests {
let test_image_no_alpha = generate_color_wheel(SIZE, SIZE, false);
let encoded = Encoder::from_image(&test_image_no_alpha).encode_lossless();

let decoded = Decoder::new(encoded.deref()).decode().unwrap().as_image().to_rgb8();
let decoded = Decoder::new(encoded.deref()).decode().unwrap().to_image().to_rgb8();
assert_eq!(test_image_no_alpha.to_rgb8().deref(), decoded.deref());


let test_image_alpha = generate_color_wheel(SIZE, SIZE, true);
let encoded = Encoder::from_image(&test_image_alpha).encode_lossless();

let decoded = Decoder::new(encoded.deref()).decode().unwrap().as_image().to_rgba8();
let decoded = Decoder::new(encoded.deref()).decode().unwrap().to_image().to_rgba8();

// To achieve better compression, the webp library changes the rgb values in transparent regions
// This means we have to exclusively compare the opaque regions
Expand Down
2 changes: 1 addition & 1 deletion src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl WebPImage {

/// Creates a DynamicImage from this WebPImage.
#[cfg(feature = "img")]
pub fn as_image(&self) -> DynamicImage {
pub fn to_image(&self) -> DynamicImage {
if self.layout.is_alpha() {
let image = ImageBuffer::from_raw(
self.width,
Expand Down

0 comments on commit 13d7ac8

Please sign in to comment.