Page 1 of 1

Gif not looping

Posted: 2011-08-08T10:49:57-07:00
by Intersekt
Hello everyone,
I'm trying to create an animate GIF using imagick on PHP. My problem is that my gif loops only once.

Image

Code: Select all

<?php
	
	$im=new Imagick();
	$bg=new Imagick();
	
	for ($i=0; $i<10; $i++){
		$bg->readImage("./test/image_$i.gif");
	}	
	$im->addImage($bg);	
	$im->writeImages("result.gif", true);

?>

Re: Gif not looping

Posted: 2011-08-08T14:53:15-07:00
by fmw42
In command line you would set a -delay for each image and at the end you would set -loop 0 so that it loops continuously.

I see setImageDelay at http://us3.php.net/manual/en/book.imagick.php but I cannot find anything like setImageLoop. But perhaps I have missed it. I am not an iMagick programmer.

Re: Gif not looping

Posted: 2011-08-08T22:15:16-07:00
by Intersekt
Yes I was searching for a setloop option too but I didn't find any. I've used this script before and I never had any problem so I don't know if report this as bug or not.

Re: Gif not looping

Posted: 2011-08-08T22:35:00-07:00
by fmw42
Intersekt wrote:Yes I was searching for a setloop option too but I didn't find any. I've used this script before and I never had any problem so I don't know if report this as bug or not.
Perhaps it is just missing from the docs. Try setImageLoop("0") just before the write and see what happens. Also use setImageDelay() before adding the frames to set the delay between frames.

Re: Gif not looping

Posted: 2011-08-08T22:57:32-07:00
by Intersekt
Call to undefined method Imagick::setImageLoop()
I added the delay(0) but nothing changes

Re: Gif not looping

Posted: 2011-08-09T05:58:00-07:00
by magick

Re: Gif not looping

Posted: 2011-08-10T23:01:26-07:00
by Intersekt
Thank you very much ;)