Page 1 of 1

Different gif cropping behavior between versions 6.9.1-7 and 6.7.7-10

Posted: 2015-07-09T08:01:22-07:00
by nikola
Hi,

When cropping with PHP Imagick, some gifs that are cropped correctly with ImageMagick 6.7.7-10 have errors after cropping on server with 6.9.1-7 version installed. What could be the problem?

One of gifs causing error:
Image

Thanks

Re: Different gif cropping behavior between versions 6.9.1-7 and 6.7.7-10

Posted: 2015-07-09T08:06:03-07:00
by snibgo
Please provide a command that behaves differently between the versions.

Re: Different gif cropping behavior between versions 6.9.1-7 and 6.7.7-10

Posted: 2015-07-09T08:14:17-07:00
by nikola
Here is the PHP code responsible for cropping:
--------------------------------------------------------------------
$image = new \Imagick($file->tempName);

if($file->type=="image/gif") //determine image format
{
//if it's GIF file, resize each frame
$image = $image->coalesceImages();

if ($play_once) {
$image->setimageiterations(1);
}
$i = 0;
foreach ($image as $frame) {
$frame->cropImage($image_width,$image_height,$x,$y);
$frame->setimagepage(0, 0, 0, 0);

if ($i==0) {
$preview_path = str_replace('.gif', '.png', $upload_path);
$frame->writeimage($preview_path);
}

$i++;
}
$image = $image->deconstructImages();
}

//write image to a file
return $image->writeImages($upload_path, true);
------------------------------------------------------------------------------------------------------------------------------------------------------------

Re: Different gif cropping behavior between versions 6.9.1-7 and 6.7.7-10

Posted: 2015-07-09T08:34:25-07:00
by dlemstra
There is a bug in the gif writer that will be resolved in 6.9.1-8.