Problems about scaling a multi-frame gif

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
livable

Problems about scaling a multi-frame gif

Post by livable »

hi all,
I came across a multi-frame gif scaling problem, the gif I construct was somehow mixed(I can't define this).

my code is here,

ImageInfo *image_info;
Image *images;
Image **image_list,*resize_image;
ExceptionInfo *exception;

image_info = CloneImageInfo((ImageInfo *) NULL);
sprintf(image_info->filename, "source.gif" );
images = ReadImage(image_info, exception);
image_list = ImageListToArray( images,exception );
if(image_list == (Image **)NULL)
{
images = DestroyImageList(images);
image_info = DestroyImageInfo(image_info);
exception = DestroyExceptionInfo(exception);
return;
}
thumbnails = NewImageList();
register long list;
for(list=0; image_list
  • != (Image *)NULL; list++)
    {
    resize_image = ThumbnailImage(image_list
    • ,100,100,exception);
      if(resize_image == (Image *)NULL)
      {
      MagickError(exception->severity, exception->reason, exception->description);
      }
      AppendImageToList(&thumbnails,resize_image);
      }
      sprintf(image_info->filename, "result.gif" );
      WriteImage(image_info, thumbnails);
      images = DestroyImageList(images);
      thumbnails = DestroyImageList(thumbnails);
      image_info = DestroyImageInfo(image_info);
      exception = DestroyExceptionInfo(exception);

      Many thanks
      PS: My Environment
      Linux ubuntu 2.6.24-23-server #1 SMP Wed Apr 1 22:14:30 UTC 2009 x86_64 GNU/Linux
      ImageMagick 0.8.20
livable

Re: Problems about scaling a multi-frame gif

Post by livable »

I think I find the reason.

Re: How to keep the picture movie after resizing it
by anthony » 2009-11-09T19:44:08+00:00

NOTE this is not normally the forum I would write in, but I know about this.

While the command line will loop though the current image sequence resizing all images. Other API's do not. You will need to loop though reach image and resize it.

WARNING: GIF animation sequences need to be coalesced (layer method) into proper images without optimization before resizing. You can optimize (also a layer method) the animation after ward for frame and transparency optimizations again afterward.Anthony Thyssen -- Webmaster for ImageMagick Example Pages
http://www.imagemagick.org/Usage/
Post Reply