I found a problem when using MagickAddImage, here is my code:
Code: Select all
<?php
$dst=NewMagickWand();
MagickNewImage($dst, 200, 200);
$src2=NewMagickWand();
MagickReadImage($src2,"src2.gif");
MagickSetImageIndex($src2,0);
MagickCompositeImage($dst,$src2,MW_OverCompositeOp,0,0);
MagickSetImageDelay($dst,200);
$numimgs=MagickGetNumberImages($src2);
for($i=1;$i<$numimgs;$i++) {
MagickSetImageIndex($src2,$i);
MagickAddImage($dst,$src2);
}
MagickSetFormat($dst,"GIF");
MagickWriteImages($dst,"dst.gif",true);
echo 'DONE!!!';
?>
After running the script, the result (dst.gif) is:
As you can see, the MagickAddImage seems to add the image in reverse order, how to make it to add image in appropriate order? (I cannot reverse the logic of the codes because I need to compose the first frame of src2.gif to new image).
Thanks in advance.