Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Lossy GIF compressor

This is an encoder (based on gifsicle) which implements lossy LZW compression. It can reduce animgif file sizes by 30%—50% at a cost of some dithering/noise.

Downloads and source code on GitHub

Usage

./gifsicle -O3 --lossy=80 -o lossy-compressed.gif input.gif

Adjust --lossy argument to quality you want (30 is very light compression, 200 is heavy).

It works best when only little loss is introduced, and due to limitation of the compression algorithm very high loss levels won't give as much gain.

How does it work

GIF's LZW compression is based on a "dictionary" of strings of pixels seen. Normal encoder searches the dictionary for the longest string of pixels that exactly matches pixels in the image. Lossy encoder picks longest string of pixels that's "similar enough" to pixels in the image (plus some magic to hide the distortions with dithering).

Examples

3.3MB original vs 1.2MB lossy recompression

fat originalsmall, slightly noisy recompression

My version (191KB)

My Lossy

Photoshop (201KB)

Photoshop Lossy

Original (438KB)

Original

Source: Fire breathing "Jaipur Maharaja Brass Band" Chassepierre Belgium by Luc Viatour

For static GIFs don't bother with this encoder and use lossy optimized PNG instead.

Illegal in the Apple App Store

App Store terms and conditions forbid distribution of Free Software that grants users freedom to use the program any way they want. You're not allowed to distribute this software with DRM applied to it.