DEV Community

Cover image for How do you deal with large GIF sizes?
Madza
Madza

Posted on

How do you deal with large GIF sizes?

Often time in a developer workflow we need to capture some short animations. That's where GIFs come in as a rescue.

Tho capturing higher resolution areas for like 10 secs comes at its price - larger file sizes, meaning longer load times for wherever you use them afterward in your projects.

How do you optimize your GIFs?

Top comments (8)

Collapse
 
miachrist profile image
Mia Christ

Thanks for asking this interesting question. I usually love to use GIF maker platforms that doesn't ask for programming skills and BannerBoo is one of them. I minimize the number of heavy effects, shorten the text size and elminita unnecessary rainbow effects.

In short, I prefer to reduce the GIF file size to optimize the GIF size. You can also go with this guide bannerboo.com/blog/how-to-optimize... to get A to Z details about optimizing GIFs or GIF banners. Best of luck!

Collapse
 
madza profile image
Madza

Thank you for the valuable input 👍✨💯

Collapse
 
bias profile image
Tobias Nickel

very good question, As I like to make some animations for presenting programming concepts.

For my personal website I was thinking to default to webp and on error switch to gif. (not sure about the exact code now.) but I found that a 500kb animation can be a 10kb webp.

I would also like to know some other opinions.

Collapse
 
madza profile image
Madza

Haha, glad I'm not the only one 😀😀

Collapse
 
slavius profile image
Slavius

If you're on Windows you can try Screen2Gif (open-source tool for screen recording with .gif output) that has also embedded editor that allows you to get rid of duplicate frames (by extending the duration of first frame and get rid of duplicates) and apply different optimization methods before exporting the .gif file (like changing the FPS, etc.). It's able to reduce the gif sizes considerably if they are not composed of completely different content on each frame (very unsuitable for movies or dynamic scenes but works perfectly for screen recordings or other kind of static content).

Collapse
 
adambelis profile image
Adam Belis

I always ask myself does this really need to be a gif? Web or even mp4 is often a better solution sometimes it can be svg+ CSS animation or Lottie.

  • If it needs to be a gif keep the frame rate low (20fps is still pretty smooth 10-5 for heavy optimalization ).
  • Then know what algorithm is best for your use case ( video vs mostly static pictures)
  • Speed up your video so it takes less time ( this is useful just sometimes for instructions etc)
  • limit the number of colors

you can do all of this online with :
ezgif.com/video-to-gif

Collapse
 
codebyjustin profile image
Justin

Hmm I usually drop the FPS.

Collapse
 
thejaredwilcurt profile image
The Jared Wilcurt • Edited