Page 1 of 1

Combine a animated GIF with a static PNG

Posted: 2011-09-25T03:12:35-07:00
by sroBandit
Hi folks,

i tried a whole day now for my problem and googling my hands off but couldnt find a real solution for my problem:
I have an animated gif and a static PNG. The static PNG should get the "background" of the animated GIF (the animated GIF also has a transparency).

I tried things like:

Code: Select all

$a = new Imagick('../a.gif');
$b = new Imagick('../b.png');

$b->compositeimage($a, imagick::COMPOSITE_MULTIPLY, 0, 0);
$b->writeimages('../img/test.gif', true);
	
$a->compositeimage($b, imagick::COMPOSITE_MULTIPLY, 0,0 );
$a->writeimages('../img/test2.gif', TRUE);
but i get an image with the animated GIF visible only or a static pic where with one of the first frames of the animated GIF + the static PNG as background.. but not animated.

Any hints would be great..

Thanks in advance

Re: Combine a animated GIF with a static PNG

Posted: 2011-09-25T11:22:41-07:00
by fmw42

Re: Combine a animated GIF with a static PNG

Posted: 2011-09-27T23:41:59-07:00
by sroBandit
Sorry for delayed answer..

Thanks for the link, i "understand" what happens there or what should be done, but i dunno know how to solve my problem in PHP.
I dont wanna use the commandline version, i want to use the lib itself.

Do i need an imagick() and an imagickDraw() object and combine them? If so, would be great, if you can gimme some help.

Re: Combine a animated GIF with a static PNG

Posted: 2011-09-28T09:50:55-07:00
by fmw42
sorry I don't code Imagick, only command line. But see if you can find similar commands at http://us3.php.net/manual/en/book.imagick.php

Re: Combine a animated GIF with a static PNG

Posted: 2011-10-05T12:49:57-07:00
by sroBandit
Ok,

tried a few other things.. Would be great, if someone could gimme a hint, i dont get any correct image..
An example would be great!

Thanks in advance..