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

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

<p>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.)</p>

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

<p>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.</p>

CC BY-SA 3.0
2016-06-07T17:03:38.827Z
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
CC BY-SA 3.0
2016-06-07T15:15:53.253Z
2016-06-07T15:15:53.253Z
RitterKnight
<p>I'd like to be able to convert an animated GIF to static for displaying in my mobile view (to reduce bandwidth etc)</p>

<p>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)</p>

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

<p>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.</p>

<p>thanks,
J.</p>

<image-transforms><gif>
Image Transform to convert animated GIF to static?
# Image Transform to convert animated GIF to static?

(Asked by: username_0 on 2016-06-07)

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.

**Tags:** image-transforms, gif

---

## 1 answers

### Answer by username_1 on 2016-06-07. Score: 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.

> **Comments:**
> **username_0**: 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  

---

