分离gif单帧图片:
方法1:
Image imgGif = Image.FromFile(fileNames[i]); //加载gif文件int nFrameCount = imgGif.GetFrameCount(ImgFrmDim);
for( int a = 0; a < nFrameCount; a++ )
{
imgGif.SelectActiveFrame( ImgFrmDim, a );
imgGif.Save( string.Format( "./导出/{0}.jpg", a ), ImageFormat.Jpeg );
PicBox.Image = imgGif;
}
------------------------------------------------------------------------------------------------------------------------------------------------
方法2:
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using Gif.Components;
string outputPath = "c:\\";
GifDecoder gifDecoder = new GifDecoder();
gifDecoder.Read("c:\\test.gif");
for (int i = 0, count = gifDecoder.GetFrameCount(); i < count; i++)
{
Image frame = gifDecoder.GetFrame(i); // frame i
frame.Save(outputPath + Guid.NewGuid().ToString() + ".png", ImageFormat.Png);
}
------------------------------------------------------------------------------------------------------------------------------------------------
合并gif:
AnimatedGifEncoder MyGif = new AnimatedGifEncoder();
MyGif.Start(path);//保存路径
MyGif.SetDelay(200);//帧率
MyGif.SetSize(300, 300);//尺寸
MyGif.SetRepeat(0);//重复
for(int i = 0; i
MyGif.AddFrame(Image.FromFile(list_pic.Items[i].ToString()));//加入单张图片
}
MyGif.Finish();
工程下载:
http://download.csdn.net/detail/wang03989/9618807
gif操作类库
http://download.csdn.net/detail/wang03989/9618833