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

Not all GIFs start with a clear code #3

Open
MarkJeronimus opened this issue Nov 14, 2017 · 2 comments
Open

Not all GIFs start with a clear code #3

MarkJeronimus opened this issue Nov 14, 2017 · 2 comments

Comments

@MarkJeronimus
Copy link

While debugging some gifs that even Paint Shop Pro fails to render (but Windows, Firefox and Microsoft GIF Animator do read correctly) I found all of them had no clear code as the first code in each frame.

Removing line 202 fixed it.

bits.read(); // Skip leading clear code

However this breaks all other GIFs because now their clear code is interpreted as a color code. Need to investigate.

@MarkJeronimus
Copy link
Author

It may be a band-aid, but this fixed it for me:

GifDecoder.java:201

		codes.clear(); // Init code table
		int code = bits.read(); // Read first code
		if (code == clearCode) { // Skip leading clear code
			code = bits.read();
		}
		int[] pixels = tbl[code]; // Output pixel for first code

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

1 participant