Home » Images » Image_Transform » Bug #5984
Cropping GIF-images
Details
| Request #5984 | Cropping GIF-images |
|---|---|
| Submitted | 2005-11-16 13:40 UTC |
| From | eh at escio dot no |
| Assigned | davidc |
| Status | Closed |
| Package | Image_Transform |
| PHP Version | Irrelevant |
| OS | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2005-11-16 13:40 UTC] eh at escio dot no
Description:
------------
When using the IM-driver, ImageMagick have trouble cropping GIF-images correctly. The problem is due to IM's handling of GIF-images. For more information see: http://www.cit.gu.edu.au/~anthony/graphics/imagick6/crop/
Solutions:
Driver/IM.php, function crop():
Add "+repage" as the last command
From:
$this->command['crop'] = '-crop '
. ((int) $width) . 'x' . ((int) $height)
. '+' . ((int) $x) . '+' . ((int) $y);
To:
$this->command['crop'] = '-crop '
. ((int) $width) . 'x' . ((int) $height)
. '+' . ((int) $x) . '+' . ((int) $y) . ' +repage';
This will remove any page information from the GIF-file. Alternatively one should add an extra parameter to the crop-function so that the user can control this behaviour himself.
[2005-11-16 13:49 UTC] eh at escio dot no
For recent versions of ImageMagick (ImageMagick version 6.2.4+) instead of the +repage command prepend the -crop command with ! like this:
Driver/IM.php, function crop():
From:
$this->command['crop'] = '-crop '
. ((int) $width) . 'x' . ((int) $height)
. '+' . ((int) $x) . '+' . ((int) $y);
To:
$this->command['crop'] = '-crop '
. ((int) $width) . 'x' . ((int) $height)
. '+' . ((int) $x) . '+' . ((int) $y) . '!'
[2007-05-01 08:15 UTC] eh at escio dot no
No, I think this should be solved in IM.php, at least with a workaround.