views:

856

answers:

4

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.

A: 

See this.

Anton Gogolev
+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
This answer also includes information about getting the timing information out in additional to the frames
John
+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
A: 

thank you, Renaud!