# Control animated gifs

**URL:** <https://pressbooks.community/t/control-animated-gifs/664>\
**Category:** Developer Questions\
**Created:** [September 4, 2018, 2:43pm UTC](https://pressbooks.community/t/control-animated-gifs/664 "2018-09-04T14:43:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lrizquierdo](https://pressbooks.community/user_avatar/pressbooks.community/lrizquierdo/32/870_2.png) [@lrizquierdo](https://pressbooks.community/u/lrizquierdo)\
**Post date:** [September 4, 2018, 2:43pm UTC](https://pressbooks.community/t/control-animated-gifs/664/1 "2018-09-04T14:43:36Z")

</div>

Hi,

I’d love Pressbooks to allow users control frames in animated gifs (or, more generally, to easily navigate a set of images). Apparently, there are several ways this could be achieved:  
[https://stackoverflow.com/questions/2385203/can-you-control-gif-animation-with-javascript](https://stackoverflow.com/questions/2385203/can-you-control-gif-animation-with-javascript)  
The way I would love to see this working is like the last answer in the previous thread, or figure 1 in this paper:  
[http://jasss.soc.surrey.ac.uk/12/1/6.html](http://jasss.soc.surrey.ac.uk/12/1/6.html)

@SteelWagstaff and I talked about this, and we realize that there is an issue on how to ensure graceful fallback in other export formats that don’t support javascript. Maybe the first frame could be shown, with a note letting the reader know that there is an animation there, and a link?

Anyway, I’d love to hear your thoughts on this. Right now I am converting my nice animated gifs into (much larger in size) videos, so the user can control the frames, but this is clearly a waste in many regards.  
Thanks a lot!  
Luis

---

<div class="post-metadata">

**Author:** ![ned](https://pressbooks.community/user_avatar/pressbooks.community/ned/32/533_2.png) [@ned](https://pressbooks.community/u/ned)\
**Post date:** [September 4, 2018, 3:39pm UTC](https://pressbooks.community/t/control-animated-gifs/664/2 "2018-09-04T15:39:42Z")

</div>

@lrizquierdo I’m not sure why your videos are bigger but MP4 video is a much more efficient format for animation: [https://rigor.com/blog/2015/12/optimizing-animated-gifs-with-html5-video](https://rigor.com/blog/2015/12/optimizing-animated-gifs-with-html5-video)

---

<div class="post-metadata">

**Author:** ![lrizquierdo](https://pressbooks.community/user_avatar/pressbooks.community/lrizquierdo/32/870_2.png) [@lrizquierdo](https://pressbooks.community/u/lrizquierdo)\
**Post date:** [September 4, 2018, 4:13pm UTC](https://pressbooks.community/t/control-animated-gifs/664/3 "2018-09-04T16:13:26Z")

</div>

Hi @ned, thank you so much for your quick and helpful response. I had tried several online tools and the size of the video was larger, but I have now used ffmpeg, as you suggested, and it is indeed smaller. Thanks a lot for that. So I guess your advice is to use .mp4, right?  
Thanks a lot!

---

<div class="post-metadata">

**Author:** ![ned](https://pressbooks.community/user_avatar/pressbooks.community/ned/32/533_2.png) [@ned](https://pressbooks.community/u/ned)\
**Post date:** [September 4, 2018, 4:44pm UTC](https://pressbooks.community/t/control-animated-gifs/664/4 "2018-09-04T16:44:24Z")

</div>

I would recommend an MP4, yes.
