Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, August 8, 2005 1:44:03 AM(UTC)
alanskinner

Groups: Registered
Posts: 3



Hello everybody (and LEAD Tools Support)

I am evaluating thi sproduct for a possible purchase by my company, we are looking for Animated GIF support.
Does anybody know if it is possible to resize animated GIFs using the .NET lib?

I get the exception...

" Invalid parameter passed" when trying to resize.
but a single image GIF resizes no problem? eh!


I create the Raster Image from an existing .net Image object, is this why it doesnt work, because .NET does not support animated GIFs?

How do i resize an animated GIF using .NET then, i was doing this, any ideas

                ResizeCommand resizeCommand = new ResizeCommand();

           
    RasterImage image = new RasterImage(Image.FromFile(@"c:\test2.gif"));
           
                resizeCommand.Flags = RasterSizeFlags.Normal;

           
    resizeCommand.DestinationImage = new RasterImage(    RasterMemoryFlags.Managed,

           
           
           
           
                    25,

           
           
           
           
                    25,

           
           
           
           
                    8,

           
           
           
           
                    RasterByteOrder.Rgb ,

           
           
           
           
                    RasterViewPerspective.TopLeft,

           
           
           
           
                    image.Palette,

           
           
           
           
                    null);
                resizeCommand.Run(image);

                Debug.WriteLine("Saving now");

           
    Image resizedImage = resizeCommand.DestinationImage.ConvertToGdiPlusImage();
                resizedImage.Save(@"C:\out.gif");

Cheers alan.


 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, August 9, 2005 2:26:42 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Hello,

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...");

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

Thanks,
Maen Badwan
LEADTOOLS Technical Support

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.106 seconds.