Page 1 of 1
Animating Woes.
Posted: 2008-09-09T12:43:16-07:00
by Handle
Code: Select all
<?php
header("Content-Type: image/gif");
$im1 = imagecreatefromPNG("image1.gif");
$im2 = imagecreatefromPNG("image2.gif");
imageGIF($im1);
imagedestroy($im1);
imageGIF($im2);
imagedestroy($im2);
?>
Hi,
I've spent the best part of a day trying to find an answer to this, basically I would like to make an animated Gif which loops between these two images, can anyone help?
Thanks
Re: Animating Woes.
Posted: 2008-09-09T23:01:11-07:00
by anthony
You will need to append one image into the wand of the other image and set the delay, disposal and looping metadata as appropriate.
A good start is understanding the GIF animation handling which IM Examples, Animation Basics goes into, though only using the command line version of IM. However everything the command line can do, the various API's should also be able to do.
Re: Animating Woes.
Posted: 2008-09-10T01:26:58-07:00
by Handle
I'm not sure I follow mate, I'm quite new to all this
do I need to use the convert command, and is there anyway to do it without using commands?
Thanks
Re: Animating Woes.
Posted: 2008-09-10T15:00:13-07:00
by Handle
Code: Select all
<?php
$namestring = "Name";
$im = '1.gif';
$im1 = '2.gif';
passthru("convert -delay 500 -loop 0 '$im' '$im1' gif:-" );
?>
ok I've made some progress, it now animates between each picture. I now need to add some text ($namestring) to the first image ($im), can anyone help?
thanks
Re: Animating Woes.
Posted: 2008-09-10T18:25:12-07:00
by anthony
See IM examples, Text Handling, and Annotating.
Also look at Animation Modification where I draw a copyright notice onto separate frames on an animation
http://www.imagemagick.org/Usage/anim_mods/#frame_mod
NOTE you should be able to do this without using the command line version, though thanks to IM examples there is a lot more examples in using IM via the command line version, weather it run from PHP or from Shell.
NOTE; PHP actually runs commands through Shell as well making three API layers to deal with. I have not seen a simple 'exec()' type system call in the PHP api to allow you to avoid having a IM command parsed by the shell as well (changling the initial quoting and command argument seperation). This is a real security problem for PHP!
Re: Animating Woes.
Posted: 2008-09-11T04:16:37-07:00
by Handle
Code: Select all
<?
header('Content-Type: image/gif');
$im = 'image1.gif';
exec("convert $im -font Fonts/arial.ttf \\
-pointsize 50 -draw \"gravity north fill black text 0,-5 'TEXT' \");
$im1 = 'image2.gif';
passthru("convert -delay 500 -loop 0 '$im' '$im1' gif:-" );
?>
could I not draw onto the first image and the create an animation? I tried it above but it didn't work, so maybe not?
Thanks
Re: Animating Woes.
Posted: 2008-09-12T02:07:52-07:00
by anthony
Should be able to. test it out on the command line first.