Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling GIF animation in HTML

Tags:

Is there any way, in HTML, to include an animated GIF in an <img> tag, but automatically tell the GIF to not animate? I realize that the user can stop animation by pressing ESC or clicking Stop, but I want the GIFs not to animate at all.

I only want to do this on one specific page, and making separate non-animated versions of the (1500+) GIFs is not feasible. I simply want the GIFs to not animate.

like image 606
dirtside Avatar asked Jun 05 '09 00:06

dirtside


People also ask

How do I stop my HTML from looping GIFs?

Go to the Window tab and select timeline(if the timeline is not already open). At the bottom of the timeline panel, you will find an option, which says "Forever". Change that to "Once". Go to File> Export> Export for Web and save it as a gif.

How do you stop an animated GIF?

The next time you're tired of seeing a GIF on a webpage just hit Esc on your keyboard and the GIF stops. This includes every GIF on a webpage. Even a page filled with animated GIFs, like Giphy, will stop with one key press. Hit Esc again and the GIFs start moving again.

How do I turn off browser animation?

In the Search bar, type image, then find the entry for image. animation_mode in the search results. Double-click this option, set the value to none, and click the checkmark button. Close and restart Firefox for the setting change to take effect.


2 Answers

You could use Giffer.

Just include the library in your page:

<script type="text/javascript" src="gifffer.min.js"></script> 

Instead of setting src attribute on your image use data-gifffer.

<img data-gifffer="image.gif" /> 

At the end, call Gifffer() whenever you want. For example:

window.onload = function() {     Gifffer(); } 

If you don't want the GIF to move at all you can always edit the .js file to remove the play button.

like image 123
Josue Marin Avatar answered Sep 22 '22 06:09

Josue Marin


Not with plain HTML but using PHP with imagecreatefromgif might help you

like image 42
victor hugo Avatar answered Sep 24 '22 06:09

victor hugo