Compose one animation over another
Posted: 2008-09-03T13:02:11-07:00
Hi all,
I'm having a bit of trouble with putting an animated GIF over another animated GIF. I've got it so that I can overlay an animation over a static image, but then I want to make an animated 'border' for the image, but I can't. Inexplicably, my code worked for a bit, then stopped working - maybe I changed something by accident? Anyways, here's the code, please tell me if you can see me doing anything wrong.
Basically, what I'm trying to do is this:
1) Take a PNG image [created by PHP]
2) Overlay a transparent animated GIF over that PNG [this part works fine]
3) Overlay the animation from step two over a slightly larger, glittery animation, so as to create a border effect.
However, it doesn't work properly - what I get instead of the mostly solid animation over the glittery one is that the background flickers back and forth between covering and uncovering the foreground image.
I think it might be an issue with how I'm using -layers and -compose, but I'm just at a loss
Thanks in advance,
Stephen
I'm having a bit of trouble with putting an animated GIF over another animated GIF. I've got it so that I can overlay an animation over a static image, but then I want to make an animated 'border' for the image, but I can't. Inexplicably, my code worked for a bit, then stopped working - maybe I changed something by accident? Anyways, here's the code, please tell me if you can see me doing anything wrong.
Basically, what I'm trying to do is this:
1) Take a PNG image [created by PHP]
2) Overlay a transparent animated GIF over that PNG [this part works fine]
3) Overlay the animation from step two over a slightly larger, glittery animation, so as to create a border effect.
Code: Select all
shell_exec("convert glitter/".$_REQUEST['glitter']." -virtual-pixel tile -set option:distort:viewport ".$w."x".$h." -distort SRT 0 tile".$r.".gif"); //the transparent gif
shell_exec("convert -size ".$w."x".$h." png_temp".$r.".png null: tile".$r.".gif -gravity Center -layers Composite -layers Optimize png".$r.".gif"); //transparent GIF over PNG - works fine
if($_REQUEST['b'] != "none") // if a border was requested
{
shell_exec("convert border/".$_REQUEST['b']." -virtual-pixel tile -set option:distort:viewport ".($w+20)."x".($h+20)." -distort SRT 0 tile".$r.".gif"); //create the background animation
shell_exec("convert -size ".($w+20)."x".($h+20)." tile".$r.".gif null: png".$r.".gif -gravity Center -layers Composite -compose src-over png".$r.".gif"); //animation 1 over the background animation
}
I think it might be an issue with how I'm using -layers and -compose, but I'm just at a loss
Thanks in advance,
Stephen