arsogio996
arsogio996

Reputation: 41

Incomplete imges from decoded .gif

enter image description here

I've decoded .gif files into individual images but either because of the encoding of the original .gif(s) or something else. The first decoded frame is fine for every other frame what I get is only a partial render. I think the common shared pixels that are the same on every frame of the .gif are being left out of subsequent frames.

Thoughts? Solution? Has anyone encountered this problem before?

Upvotes: 1

Views: 154

Answers (2)

arsogio996
arsogio996

Reputation: 41

Using .gifs with low levels of compression (no transparency, no stacking) prevents the loss.

Upvotes: 0

Joey
Joey

Reputation: 354586

If you really take and draw only a single frame of the GIF file, then this is probably to be expected. Animated GIFs often are optimized in that way since during the animation each frame is layered on top of the last, so a lot of frames are mostly transparent and only contain the changed parts (and I think frames can also be smaller than the image itself in addition to that). This cuts down on file size a lot.

This means, however, if you want to show the user what frames would actually be displayed in the animation, you have to reconstruct them by drawing all previous frames first.

Upvotes: 3

Related Questions