-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
No pages
metadata for animated gif
#1566
Comments
Bonjour, it looks like sharp needs to expose libvips' At the command line i see: $ vipsheader -a small-animated-hear-see-speak-no-evil-moving-monkey.gif | grep page
$ vipsheader -a small-animated-hear-see-speak-no-evil-moving-monkey.gif[n=-1] | grep page
page-height: 157 So it looks like libvips itself also needs to expose the GIF page count too. |
gifload was not setting the n-pages metadata item. n-pages is supposed to be the number of pages in the original file (not the number of pages libvips loaded), but we don't always know this for gif, since you have to decode the entire file to count the pages. As a compromise, set it to the page number of the final page we read. See lovell/sharp#1566
I dunno if this is related but I see not |
I also get a |
The forthcoming libvips v8.8.0 will add support for animated WebP. libpng does not support animated PNG. |
Ah that makes sense now. Thanks @lovell :) |
Commit 9cc06c8 expose libvips' |
v0.22.0 now available. |
Salutations! I think it's related to this issue. I'm using sharp 0.22.1 and I'm trying to extract the number of pages of a GIF to determine if it's a animated one. But each time the metadata doesn't contains the pages attribute. I've tried with several GIF picked on the web and also with the one that Jaubourd provides. Here is a small standalone that show the issue. wget http://www.netanimations.net/small-animated-hear-see-speak-no-evil-moving-monkey.gif
node -e "require('sharp')('small-animated-hear-see-speak-no-evil-moving-monkey.gif').metadata().then((meta) => console.log(meta, meta.pages))" Am I missing something ? :) |
It looks like libvips 8.8.0 is required for the |
Hi Lovell, hope you're well. Am I right in saying animated gif input to animated webp output will be possible in the near-ish future? |
@tomgallagher libvips v8.8.0 supports this. |
And lipvips v8.8.0 may be included in Sharp 0.23.0? |
@tomgallagher Yes, that's the plan. |
Great. Thanks. |
@lovell If the Sharp API need to change to accommodate libvips v8.8.0, I can help with the documentation if that's plausible and time-saving. |
Maybe I'm doing something wrong but whenever I load an animated gif and do operations on it, I always end up with the first frame transformed and that's it.
In order to determine if this was due to something deep into our code, I looked more closely into the metadata reported by sharp for animated gifs.
From what I understand from the docs, an animated image is supposed to give a
pages
value that is a number.If I input an animated monkey found online, I end up with a
metadata.pages
that'sundefined
and sharp only acts on the first frame.Is this by design? Am I missing something?
Also, I saw outputting animated webp was supported but is outputting apng supported too? Could be nice to have a clear support grid somewhere in the docs where this kind of things would be listed. But I know how difficult and time-consuming writing docs can be ;)
The text was updated successfully, but these errors were encountered: