使用代码裁剪动画GIF

时间:2012-07-25 05:03:28

标签: c# .net image system.drawing animated-gif

我正在使用像

这样的代码
string originalfilename = Server.MapPath(" ") + "\\img\\" + file_image.FileName;
string originalrelative = "\\img\\" + file_image.FileName;
file_image.SaveAs(originalfilename);
string thumbfilename = Server.MapPath(" ") + "\\img\\t_" + file_image.FileName;
string thumbrelative = "\\img\\t_" + file_image.FileName;
Bitmap original = new Bitmap(originalfilename);
int squareside = 0;
if (original.Width >= original.Height) { squareside = original.Height; } 
 else { squareside = original.Width; }
Bitmap squareimage = (Bitmap)original.Clone(
    new Rectangle(new Point(0, 0), new Size(squareside, squareside)),
    System.Drawing.Imaging.PixelFormat.DontCare);
Bitmap thumb = (Bitmap)squareimage.GetThumbnailImage(200, 200,
    new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback),
    IntPtr.Zero);
thumb.Save(thumbfilename);
file_original = file_image.PostedFile.FileName;
file_thumb = "t_"+file_image.PostedFile.FileName;

获取每个上传图片的缩略图,我使用网站周围图片的缩略图版本。我应该如何操作此代码以将gif文件保存为动画gif文件?当我获得动画GIF的缩略图时,此代码将它们保存为普通的GIF。当然位图类不支持动画GIF,但.net框架支持任何替代方案吗?

0 个答案:

没有答案