Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

proposal: x/image/webp: add animation support to the decoder #53364

Open
bep opened this issue Jun 14, 2022 · 6 comments
Open

proposal: x/image/webp: add animation support to the decoder #53364

bep opened this issue Jun 14, 2022 · 6 comments

Comments

@bep
Copy link
Contributor

bep commented Jun 14, 2022

I did search for this, as I expected someone to have raised this issue before.

I tried to decode a webp image with animation and got:

webp: invalid format

The behaviour of gif.Decode in this situation is to decode the first frame. And then there is gif.DecodeAll which gives you a struct with all frames and the timing etc. information. It would be nice to have a webp.DecodeAll or similar.

@bep bep added the Proposal label Jun 14, 2022
@gopherbot gopherbot added this to the Proposal milestone Jun 14, 2022
@DeedleFake
Copy link

Animated WebP has depressingly poor support, even on Android, despite being vastly superior to GIF in many, many different ways. It would be fantastic if Go could add it.

@ianlancetaylor
Copy link
Contributor

CC @nigeltao

I doubt that anybody is opposed to doing this, but somebody has to do the work. I'm not sure that this needs to be a proposal at this stage. Accepting a proposal won't cause the work to be done.

@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) Jun 14, 2022
@nigeltao
Copy link
Contributor

Yeah, I agree with what @ianlancetaylor said. I certainly don't have the spare time myself to work on this.

@silverwind
Copy link

A sample image can be found here: https://mathiasbynens.be/demo/animated-webp

@patricsss
Copy link

I have a working implementation of this, I just need to clean it up and submit a PR.

@patricsss
Copy link

patricsss commented Jul 26, 2023

https://go-review.googlesource.com/c/image/+/513295

Still needs some cleanup and documentation, but that's the gist of it.

webp/vp8 is kind of funky. I'm torn between two things and would love feedback:

  1. Keep the decoder as parsing vp8/webp and returning the appropriate image data/metadata

This has a major pain-point/drawback which is that the image frames are offset and aren't necessarily what you want from trying to decode the data or

  1. Re-write the image data into new images, taking into account the Frame{X,Y} and Frame{Width,Height} values from the ANMF frame headers.

This would make the library more useful, but also is more expensive to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Incoming
Development

No branches or pull requests

7 participants