ETC/LeadTools Lecture

gif Resize Save

현이빈이 2008. 9. 8. 16:44
반응형
The following code shows how to load an animated GIF file, resize it, and then save the result as animated gif file:

The following code shows how to load an animated GIF file, resize it, and then save the result as animated gif file:
+---------------------------+
using Leadtools.ImageProcessing;
using Leadtools;
using Leadtools.Codecs;
...
private void button5_Click(object sender, System.EventArgs e)
{
int i =0;
IRasterImage image;           
RasterCodecs codecs = new RasterCodecs ();
ResizeCommand resizeCommand = new ResizeCommand();
image = codecs.Load(@"c:\qtrres.gif",0,CodecsLoadByteOrder.BgrOrGray,1,-1);
resizeCommand.Flags = RasterSizeFlags.Normal;
resizeCommand.DestinationImage = new RasterImage (RasterMemoryFlags.Managed , image.Width / 2, image.Height / 2, image.BitsPerPixel, image.Order , image.ViewPerspective, image.Palette , null );

for( i=1;i<image.PageCount;i++)
{
image.Page = i;
resizeCommand.Run(image);
codecs.Save(resizeCommand.DestinationImage,@"C:\out1.gif",RasterImageFormat.Gif,8,1,1,1,CodecsSavePageMode.Append  );
}
MessageBox.Show("Image Saved...");

}
+---------------------------+

반응형