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
binfolder. 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.
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.
.\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
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
Example 2 - lossy=40
Example 3 - lossy=50
Example 4 - lossy=60
Example 5 - lossy=70
Example 6 - lossy=80
Example 7 - lossy=90
Example 8 - lossy=100
Example 9 - lossy=110
Example 10 - lossy=120
Example 11 - lossy=130
Example 12 - lossy=140
Example 13 - lossy=150
Example 14 - lossy=160
Example 15 - lossy=170
Example 16 - lossy=180
Example 17 - lossy=190
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!
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.