For some gif-files this decoder work, for some other - don't.
I downloaded source code of that project and found the code which doesn't work correctly. It is situated in the ImageTools.IO.Gif\GifDecoder.cs
file, the Decode
method:
int nextFlag = stream.ReadByte();
while (nextFlag != 0)
{
//...
}
But this gif contains the 0 byte right in the middle, so that the decoder stops where it shouldn't. The solution is to change this flag to -1 so that we are sure that the gif image will be read to the end:
int nextFlag = stream.ReadByte();
while (nextFlag != -1)
{
}
So you need either to recompile this library or to include the ImageTools.IO.Gif
project in the form of source code rather than in the form of dll.
You can download the sample project here: http://dl.dropbox.com/u/8047386/StackOverflow/TestGif.zip
But I'm not sure that one can rely on this fix. Anyway I opened the issue at codeplex.