-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support for animated gifs #3
Comments
The underlying Vips library doesn't support animated gifs (see: https://github.com/jcupitt/libvips/issues/235) but perhaps gifsicle could be used for resizing animated gifs once they've been detected? It's also possible to resize animated GIFs using ImageMagick's coalesce feature but I don't think it's as performant as gifsicle, which is optimized specifically for gifs. |
Doesn't appear that gifsicle has native Node support; there's a npm module but that just finds the executable. Are there any Node libraries that do support GIFs? |
I've not yet found one that does gif support natively, so maybe going the ImageMagick/GM route is best until something better is found, since those libraries are available on Lamda. |
Yeah I had looked into this for a bit, but never found anything. I'd be open to doing it if we had a good node library, right now we just have animated gif detection to not resize animated gifs as that by default will just take the first frame, |
Might be able to help out here: we ran into a similar problem with a 10up client who wanted to be able to resize gifs while preserving animation. Since Gifsicle doesn't have native PHP bindings, we ended up running Gifsicle on the web server via I wrote about the math behind it last summer, which was as much of the code that I could share without stepping on work-for-hire issues. Hopefully that'll help :) (Thanks to @bswatson for bringing this to my attention) |
@stevegrunwell Thanks for the info, super useful! I looked into Gifsicle previously as well, but there's no native Node bindings, and we can't run arbitrary executables on Lambda. :( That said, maybe it's worth us building those bindings out. Given that most of the complexity is on the Gifsicle side, I imagine the Node connection would be quite simple. |
See https://github.com/jcupitt/libvips/issues/620 I'm not super concerned about it tbh, I think it's a lot more effort than it's worth, however it's a nice-to-have if it ever does happen. Leaving the ticket open for #thefuture. |
It appears it's in development! libvips/libvips#839 (comment) At the end of the ticket is a user who is able to copy a jpeg to a gif, so maybe worth looking into again? |
Looking further, it appears Sharp has an issue tracking support: lovell/sharp#1372.
If I'm reading this right, we just need to compile our own copy of |
Looks like there has been some movement on the feature request upstream with a feature PR at lovell/sharp#2012. What's interesting is that the team with the PR is running this on production, so I suspect it's much closer to being added upstream. I recall seeing support for this on a recent VIP project as well - so maybe VIP did something custom for their support. |
Ideally resize, but if that's not possible, just return the original.
The text was updated successfully, but these errors were encountered: