问题
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:
Try this:
using System.Drawing;
using System.Drawing.Imaging;
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);
回答2:
a bit of googling: editing animated gif's in c#
You can read the animated Gif with Image.GetFrameCount() and SelectActiveFrame().
来源:https://stackoverflow.com/questions/540701/access-gif-frames-with-c-sharp