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

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
nikola
Posts: 2
Joined: 2015-07-09T06:50:04-07:00
Authentication code: 1151

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

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post by snibgo »

Please provide a command that behaves differently between the versions.
snibgo's IM pages: im.snibgo.com
nikola
Posts: 2
Joined: 2015-07-09T06:50:04-07:00
Authentication code: 1151

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

Post 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);
------------------------------------------------------------------------------------------------------------------------------------------------------------
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post by dlemstra »

There is a bug in the gif writer that will be resolved in 6.9.1-8.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply