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

Transparent GIFs with different layer sizes #685

Open
OzerOzdemir opened this issue Oct 8, 2024 · 1 comment
Open

Transparent GIFs with different layer sizes #685

OzerOzdemir opened this issue Oct 8, 2024 · 1 comment

Comments

@OzerOzdemir
Copy link

When a transparent gif has layers with different sizes, the animation looks off with lots of artifacts. This is present in multiple example sources, and also seems to be the original root cause of #631

The fix is to set x to pDraw->iX, similar to how y is set to y = pDraw->iY + pDraw->y; // current line

    if (pDraw->ucHasTransparency) // if transparency used
    {
      uint8_t *pEnd, c, ucTransparent = pDraw->ucTransparent;
      int x, iCount;
      pEnd = s + pDraw->iWidth;
      x = 0 // ----------- > This should be x = pDraw->iX;
@panki27
Copy link

panki27 commented Nov 11, 2024

The issue exists not in this library, but in https://github.com/bitbank2/AnimatedGIF (or rather the provided sample code).
While your fix has improved things, it didn't completely solve all the ghosting issues I had.

I found a workaround:

  • Go to https://ezgif.com/optimize
  • Upload your GIF that is not displaying correctly
  • Choose "Unoptimize (coalesce)"
  • Save the modified GIF

This will turn the GIF into a slideshow of full frames, no transparency or layers involved. After doing this, I got a 3100 frame GIF to play flawlessly.

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

2 participants