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

Problem with new GIF/LZW optimizer #54

Closed
AiZ opened this issue Sep 17, 2018 · 3 comments
Closed

Problem with new GIF/LZW optimizer #54

AiZ opened this issue Sep 17, 2018 · 3 comments

Comments

@AiZ
Copy link

AiZ commented Sep 17, 2018

Hello,

There's (again) a new optimizer for GIF files.
https://encode.ru/threads/3008-flexiGIF-lossless-GIF-LZW-optimization
https://create.stephan-brumme.com/flexigif-lossless-gif-lzw-optimization/
GIF files generated with gifski v0.8.5 are problematic with this tool while v0.8.2 and below encodes are OK (took 10 png frames from Big Buck Bunny for the test).
Would you mind participate to the discussion on encode.ru forum?

Thanks in advance,

AiZ
@stbrumme
Copy link

stbrumme commented Sep 17, 2018

As you know, LZW data is split in blocks with at most 255 bytes each.
Unused bits of the last byte of a frame have to be filled with dummy data. However, there are 8 unused bits in the 7th frame, so the entire last byte is redundant. (gifski 0.8.5)

Below is the animation (first 10 frames of Big Bunny are black or almost black, so nothing interesting to see ...)

bigbunny_frames_1_to_10

@kornelski
Copy link
Member

gifski encodes GIFs using Piston's encoder, so LZW bugs are best filled there: https://github.com/PistonDevelopers/image

@stbrumme
Copy link

I added a workaround in my code for that situation (display an error message, skip the unused/redundant byte and continue).
FYI: I never saw 9 or more unused bits, so it seems to be a typical off-by-one issue.

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

No branches or pull requests

3 participants