There’s a lot of funny you can convey using a gif, and I love using them on this blog. Who doesn’t love cat gifs?
More often than not I will convert a small part of a video to gif, looping it. You can see that happening, recently, in the verses, posted on this blog.
The problem I face while converting, or simply using gifs from the Internet is optimisation. I like to conserve space, and bandwidth as much as I possibly can. Gifs, while they are awesome to use, do tend up to take space, and bandwidth.
What To Use To Optimize Gifs
-
Ezgif.com: For a long time ezgif.com has been my goto size for anything gif-fy. Creating gifs from videos, optimising, resizing, and so on. You can do all sorts of stuff to your gifs with ezgif. It’s a great resource to bookmark! Especially if you don’t have the option of installing something like giflossy (see below), to help you optimise your gifs.
-
giflossy A.K.A Lossy GIF compressor: Ezgif, while brilliant is an online resource for all things gif. With that said, I first stumbled onto giflossy on ezgif.com. Who woulda thunk? Giflossy is a small binary, that you can download, and move to your
bin
folder. Making it super easy to optimise your gifs. Giflossy is available as a pre-compiled binary for Linux, and Mac. If your operating system isn’t supported, then you can download the source code, compile and install. It’s an encoder based on gifsicle, implementing lossy LZW compression .
Ezgif offers a lot of options for playing around with gifs, and overall does a great job of optimising them. It’s very simple to use, and it’s free!
Giflossy is free too. The advantage of giflossy, for me, is that it’s available offline as a binary. I have script written which runs giflossy automatically if, and when a gif is found within a post, while publishing to this blog.
Using Giflossy
Giflossy is very simple to use. It can reduce a gif file size by 30-50% at the cost of some noise, and dithering. Which I am okay with; they are gifs at the end of the day.
Usage:
.\gifsicle -O3 --lossy=80 -o lossy-compressed.gif input.gif
By adjusting the value of the --lossy
argument, you can decide the quality of the compressed gif. 30 is very lightly compressed, while 200 is heavy.
Oh, and that -O3
is a capital an O
, and not a 0
.
If you move the binary to your bin
folder, it’s easier to execute from any locating. Alternative you can simply add the path/to/gifsicle
to your $PATH
var, in you bash profile too.
Comparison Of Some Compressed, And Uncompressed Awesome Cat Gifs
Here are 17 examples of cat gifs (go ahead, I won’t judge you! I love ‘em too!) compressed with giflossy. Each example increases the value of the –lossy argument by 10. So you can compare, and see the results for yourself.
I found the sweet-spot at 90, 100, and 110. (The script I wrote, see above, uses 100).
There are other options that you can use with giflossy. These options come builtin with gifsicle, which is essentially what giflossy is based on.
Example 1 - lossy=30
Uncompressed: 1.3MB
Compressed: 624KB
Example 2 - lossy=40
Uncompressed: 1.3MB
Compressed: 995KB
Example 3 - lossy=50
Uncompressed: 1.9MB
Compressed: 1.4MB
Example 4 - lossy=60
Uncompressed: 794KB
Compressed: 402KB
Example 5 - lossy=70
Uncompressed: 1MB
Compressed: 767KB
Example 6 - lossy=80
Uncompressed: 412KB
Compressed: 271KB
Example 7 - lossy=90
Uncompressed: 488KB
Compressed: 385KB
Example 8 - lossy=100
Uncompressed: 2MB
Compressed: 1.2MB
Example 9 - lossy=110
Uncompressed: 513KB
Compressed: 241KB
Example 10 - lossy=120
Uncompressed: 847KB
Compressed: 391KB
Example 11 - lossy=130
Uncompressed: 1.9MB
Compressed: 1.2MB
Example 12 - lossy=140
Uncompressed: 2.1MB
Compressed: 1.2MB
Example 13 - lossy=150
Uncompressed: 1MB
Compressed: ~900KB
Example 14 - lossy=160
Uncompressed: 2.1MB
Compressed: 767KB
Example 15 - lossy=170
Uncompressed: 2.1MB
Compressed: 552KB
Example 16 - lossy=180
Uncompressed: 371KB
Compressed: 236KB
Example 17 - lossy=190
Uncompressed: 1.5MB
Compressed: 552KB
Example 18 - lossy=200
Umm… Yea, that’s not a cat, or a shark. I love dogs too! So I had to have one for them too!
Uncompressed: 2.1MB
Compressed: 1.1MB
Get Giflossy
The binaries are only available for Mac, and Linux. But, you could download the source, and compile it, if you are inclined to do so. Alternatively, you could just use ezgif.com.