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

Better support/handling of animated gifs #4301

Open
klonos opened this issue Feb 5, 2020 · 0 comments
Open

Better support/handling of animated gifs #4301

klonos opened this issue Feb 5, 2020 · 0 comments

Comments

@klonos
Copy link
Member

klonos commented Feb 5, 2020

Drupal/Backdrop does not handle animated gifs well. This is mainly to the fact that when any image style is applied to animated gifs, they are turned into static gifs.

This issue here is in order to discuss if there is something we can do about this problem, and whether it needs to be handled in core or leave it for contrib.

There are a few D7/8 modules that try to deal with this in different ways:

Animated GIF Ignore (sandbox)

When enabled, this module will skip any image effect for animated GIFs for all styles. This will prevent animated GIFs to be turned into static images, but of course won't apply any style. If possible, you should use ImageMagick with this patch.

https://www.drupal.org/project/animated_gif (D8-only)

This module allows you to use animated GIFs on your site.
If the mime-type of the file is image/gif, the image formatter will ignore the Image styles and renders the original GIF.
No extra config needed, just enable the module!

Use this with caution! No image-styles are applied, so the image dimensions will not be changed and can break your styling!

https://www.drupal.org/project/animgif_support (D7)

This project provides animated GIF resize and scale support for image styles with GD.

It uses a library written by Taha Paksu (GIF Animation Resizer).

This module supports only "resize" and "scale". However, "resize" is quite useless for animated GIFs. The actions "crop" and "scale and crop" will both do resize only since the used lib does not support crop.

Caveats: It can happen that the generated image does not appear for the first time. Just reload the page if this happens.

ImageAPI issue: https://www.drupal.org/node/1115658
ImageMagick issue: https://www.drupal.org/project/imagemagick/issues/1802534

https://github.com/coldume/imagecraft

Imagecraft is a reliable and extensible PHP image manipulation library. It can edit and compose images in multiple layers and supports watermark, resize and text. Furthermore, it keeps GIF animation, optimizes memory usage, catches memory exhausted error, and gives an user-friendly/translated feedback.

Imagecraft is intended to be an image abstraction & manipulation layer, which offers a PDO-like API. It currently supports GD extension, and will support ImageMagick in version 2.0. If you have any suggestions, comments or feedback, let me know. Thanks.

Other resources online on the matter:

https://stackoverflow.com/questions/718491/resize-animated-gif-file-without-destroying-animation

https://bkosborne.com/blog/preventing-drupal-8-applying-image-styles-gifs-preserve-animation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant