Access GIF frames with C#

霸气de小男生 提交于 2019-12-17 19:18:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!