I'd like to be able to convert an animated GIF to static for displaying in my mobile view (to reduce bandwidth etc)

currently it seems I can only really set the output to JPG for this (PNG seemed to break the image and if i set to GIF it stays animated)

does anyone have any suggestions for this please? is it possible to extend the Image Transforms?

I guess I'd need to create some kind of plugin? at least that way I could extend it to define a frame number to use etc within my twig template.

thanks, J.

1 Answer 1


Is this a one-off image or do you need to use the transform for a bunch of GIFs?

There's no way automated way to tap into transforms currently. (Craft 3 is going to be much better in this respect.)

The other hard part is you're probably going to want to specify what frame of the GIF to use. (Fun fact: years before browsers supported animated gifs, they would simply show either the first frame or the last frame.)

If it were me, I'd set the static frame manually using whatever method you want (Photoshop, Imagemagick/gd on the command line, etc.)

Then use a custom field on the asset to relate that static gif back to its animated counterpart. Unlike in other CMS, this is where Craft really becomes powerful.

  • GIFs can be uploaded at any time to image fields in news stories. so the conversion code is currently in the template. <img src="{{ image.getURL('gifjpg') }}" /> this seems to show the last frame from my initial tests. I wasn't sure what you meant by your last point? do you mean create an extra field for each GIF image upload? that's awkward currently in the CMS as the matrix allows the user to upload multiple images which could be GIF or JPG or PNG. I can only see it working as a twig filter/function really
    – jmp909
    Jun 7, 2016 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.