Page 1 of 1

Problems about scaling a multi-frame gif

Posted: 2010-04-06T04:06:16-07:00
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

Re: Problems about scaling a multi-frame gif

Posted: 2010-04-06T18:48:46-07:00
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/