Page 1 of 1

basic animated gif help

Posted: 2007-03-24T13:46:08-07:00
by the1bullet
having some difficulty creating a very basic animated gif. I'd just like to create a gif that repeatedly cycles between two frames. my code so far looks like this.

Code: Select all

$img1 = NewMagickWand();
MagickReadImage( $img1, $location1 );
MagickSetImageDelay( $img1, 200);

$img2 = NewMagickWand();
MagickReadImage( $img2, $location2 );
MagickSetImageDelay( $img2, 200);

$final = NewMagickWand();
MagickAddImage($final,$img1);
MagickAddImage($final,$img2);

MagickSetFormat($final, 'GIF');
header('Content-Type: ' . MagickGetMimeType($final));
MagickEchoImagesBlob($final);
This creates a gif that cycles between img1 and img2 only once. How do I get it to repeat?

Re: basic animated gif help

Posted: 2007-03-25T20:43:40-07:00
by anthony
Set loop to 0.


There is also a MagickCore function and now command line otpion to 'reverse' an image sequence (list). That clous emake patrol cycled animations easier...

See IM Examples, Reverse an animation.
http://www.imagemagick.org/Usage/animations/#reverse

Re: basic animated gif help

Posted: 2007-03-25T21:27:28-07:00
by the1bullet
How would I set loop to zero with MagickWand for PHP? None of the functions seem to obviously allow a setting for loop. I'm trying to avoid using the command line.

Re: basic animated gif help

Posted: 2007-03-25T22:10:00-07:00
by anthony
In perl magic you would

$image->Set(iterations=>0);

I don't know how this is done in Magick Wand however.

Re: basic animated gif help

Posted: 2007-03-25T22:40:07-07:00
by the1bullet
Thanks very much! Here's the answer: MagickSetImageIterations.

Re: basic animated gif help

Posted: 2007-03-26T05:12:04-07:00
by anthony
Good to hear.

Re: basic animated gif help

Posted: 2007-07-27T04:26:33-07:00
by Aniruddha
_
sorry by mistake I have posted this here