Posts tagged with “gif”

High quality, low filesize GIFs

We’ll install gifsicle via brew install gifsicle and throw our GIF into it with the following:

gifsicle -O3 --lossy=65 --gamma=1.2 kitties2.gif -o kitties3.gif

So what’s going on here?`

  • O3 is essentially gifsicle’s most efficient mode, doing fancy things like delta frames so changes between frames are stored rather than each frame separately
  • lossy=65 defines the level of compression, 65 has been a good middle ground for me (200 I believe is the highest compression level)
  • gamma=1.2 is a bit confusing, but essentially the gamma controls how the lossy parameter reacts to (and thus compresses) colors. 1 will allow it to be quite aggressive with colors, while 2.2 (the default) is much less so. Through trial and error I’ve found 1.2 causes nice compression without much of a loss in quality

The resulting GIF is now 23.8MB, shaving a nice additional 22MB off, so we’re now at a meager 5% of our original filesize.