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
- ,100,100,exception);