Hi, I'm a beginner in C#. I would like to know if there's a way to access different frames inside a GIF animation with C#. I'm using Visual Studio 2008.
+1
A:
a bit of googling: [http://social.microsoft.com/Forums/en-US/netfxbcl/thread/fcb7d14d-d15b-4336-971c-94a80e34b85e][1]
You can read the animated Gif with Image.GetFrameCount() and SelectActiveFrame().
PoweRoy
2009-02-12 10:19:15
This answer also includes information about getting the timing information out in additional to the frames
John
2009-08-04 11:59:45
+1
A:
Try this:
Image gifImg = Image.FromFile(pathToGifFile);
FrameDimension dimension = new FrameDimension(gifImg.FrameDimensionsList[0]);
// Number of frames
int frameCount = gifImg.GetFrameCount(dimension);
// Return an Image at a certain index
gifImg.SelectActiveFrame(dimension, index);
Renaud Bompuis
2009-02-12 10:26:09