This project is read-only.

GIF Decoder bug


Hi, there is a bug in the GIF decoder for some GIFs (search for "strange-little-girl-kid-gifs.gif" for example), whereby frames are dropped.

In GifDecoder.cs, in the ReadFrame() method, there is a final stream.ReadByte() which presumably returns zero under normal conditions, as all pixel data has been read above it. But in this particular GIF, another block of length 1 exists. After the block of length 1 is read (in the if(blockSize > 0)), another block size header is never read, causing the stream to be sitting on a zero at the next read, which aborts the main while loop.

Suggest replace the if/blocksize code with Skip(0);, which works for me.

Great library otherwise, have used it in my WP8 app.


Swinburne wrote Feb 19, 2014 at 2:40 AM

Check this post articel on image reader, including gif image decoder, you can load the gif image from local file or memory stream for post-processing operations, like gif image scaling, flipping, cropping, and many more.