Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement --lossy LZW compression #72

Closed
wants to merge 3 commits into from
Closed

Conversation

denji
Copy link

@denji denji commented Jul 17, 2016

Based on gifsicle which implements lossy LZW compression.
It can reduce animgif file sizes by 30%—50% at a cost of some dithering/noise.

--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.

The results are pretty good:

Original: 3.3MB

![fat smooth anim](https://cloud.githubusercontent.com/assets/3759759/16902378/a49eff78-4c65-11e6-9956-a9895fe53dfc.gif)

Lossy: 1.25MB

![noisy small anim](https://cloud.githubusercontent.com/assets/72159/2561581/f5e618e0-b81e-11e3-9243-2f8d8cb18e5d.gif)

Closed: #16

@denji denji force-pushed the lossy-kornel branch 2 times, most recently from bdea91a to 0557af8 Compare July 17, 2016 18:23
--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.

The results are pretty good:
— Original: 3.3MB
— Lossy: 1.25MB

Based on gifsicle which implements lossy LZW compression.
It can reduce animgif file sizes by 30%—50% at a cost of some dithering/noise.
— https://pornel.net/lossygifhttps://github.com/pornel/giflossy

Closed: kohler#16
@saurabheights saurabheights mentioned this pull request Apr 18, 2017
@denji
Copy link
Author

denji commented May 26, 2017

Resolved #97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants