Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

WebPMemory to DynamicImage? #33

Open
ghmendonca opened this issue Dec 7, 2023 · 1 comment
Open

WebPMemory to DynamicImage? #33

ghmendonca opened this issue Dec 7, 2023 · 1 comment

Comments

@ghmendonca
Copy link

When I use the Encoder to load a DynamicImage, and then encode that image to webp, the encode function returns WebPMemory. The issue is that I want to perform more actions with the image, like resizing and there is no easy way to convert WebPMemory back to DynamicImage.

I can see the WebPImage has a to_image function that converts back to DynamicImage but for some reason, it's not possible to create a WebPImage from WebPMemory, in fact, the WebPImage::new is not even public.

Is there a way to convert WebPMemory to DynamicImage? If not, how hard it is to implement that and release a new version to support this?

@ghmendonca
Copy link
Author

Also tried the following:

let encoder = Encoder::from_image(&self.image).unwrap();

let encoded = encoder.encode(90f32);

let image = Decoder::new(encoded.as_bytes())
    .decode()
    .unwrap()
    .to_image();

But the image returned from the decoder is broken.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant