kohler/gifsicle — pull request #16 by pornel (2014-03-29 03:06:28+00:00)
Title: Lossy

`--lossy` option that allows inexact match against LZW dictionary, which improves compression ratio. Lossy matching does a bit of 1-dimensional dithering.

This is a very basic implementation that does recursive search of dictionary nodes.

`write_compressed_data` contains some duplicated code, because the lossy search function needs to use less optimized code (ignores `imageline`), although this probably could be refactored a bit.

Currently this option is buggy when `-O3` is used. I'm not sure why (off by one error? poor handling of transparency? optimization assumes encoding is lossless?):

![bug](https://cloud.githubusercontent.com/assets/72159/2557063/8e82f2da-b6ee-11e3-88fc-bbcaa7fd1282.gif)

However, apart from that results are pretty good:

### 3.3MB original
![fat smooth anim](https://cloud.githubusercontent.com/assets/72159/2556807/61014734-b6e0-11e3-8c6a-2a376628c142.gif)

### 1.9MB lossy
![noisy small anim](https://cloud.githubusercontent.com/assets/72159/2556809/7691fc2e-b6e0-11e3-9de9-998e45019b3c.gif)