|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-06-13 07:59 UTC] carsten_sttgt at gmx dot de
Description:
------------
Hello,
- PHP-5.4.3
- PECL gmagick-1.1.0RC3 (includes the attached patch)
- GraphicsMagick-1.3.13
Below is a working code with Imagick. But this doesn't work with Gmagick.
BTW:
I'm unsure where to set the ImageFormat with Gmagick. For each frame or for the complete image right before the writeImage()?
With Imagick I'm setting the the format with setFormat() one time at the beginning, after "$gmagick = new Gmagick();". But setFormat() doesn't exists in Gmagick, and setImageFormat() doesn't work at this place, becourse the image is empty at this time(--> exception empty Gmagick object).
Regards,
Carsten
Test script:
---------------
<?php
$gmagick = new Gmagick();
for ($i = 1; $i <= 3; $i++) {
$frame = new Gmagick();
$frame->readImage(sprintf('test%s.jpg', $i));
$frame->setImageFormat('gif');
$frame->setImageDelay(1000);
$gmagick->addImage($frame);
$frame->destroy();
}
$gmagick->writeImage('test.gif', true);
$gmagick->destroy();
?>
Expected result:
----------------
No exception.
Actual result:
--------------
[13-Jun-2012 07:48:12 UTC] PHP Fatal error: Uncaught exception 'GmagickException' with message 'Can not process empty Gmagick object' in C:\Test\test.php:17
Stack trace:
#0 C:\Test\test.php(17): Gmagick->writeimage('test.gif', true)
#1 {main}
thrown in C:\Test\test.php on line 17
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 20:00:01 2025 UTC |
Helo, it seems you have to use it like this : $gmagick = new Gmagick(); for ($i = 1; $i <= 3; $i++) { $frame = new Gmagick(); $frame->readImage(sprintf('test%s.jpg', $i)); $frame->setImageFormat('gif'); $frame->setImageDelay(1000); $gmagick->nextimage(); $gmagick->addImage($frame); $frame->destroy(); } It is an issue as Imagick works as you described it.