Thursday, February 6, 2014

AnimGif and ImageCache plays well with Image Magick

The good old animated Gif is a cool format again. It works on everything, no Flash or HTML5 video needed. You can handle it as simple as a static image... or not? By default the majority of Drupal installs are using GD to create thumbnails (image styles). But the stock PHP GD extension  (coming with mod_php) lacks the functionality of properly handling animGifs and your mainpage or lister pages will remain static and boring.

The solution: switch from GD to Image Magick 

The ImageMagick (tested with version 7.x-1.0) module supports the command line Image Magick tool. On Ubuntu you can install it with a simple apt-get install imagemagick command. Once your php can run the convert command you can switch to it on /admin/config/media/image-toolkit . Don't check the Enable the GraphicsMagick support - we experienced problems with thumbnail generation when it was enabled and it's not needed anyway. With enabled Image Magick the Image javascript crop module gives crop functionality for animGifs too.
A further advantage of Image Magick is that the quality of your simple jpg thumbnails will be much better with the same compression than they are with the stock php gd.

AnimGif has reborn, Drupal should not miss the new golden age of funny movie clips! :)