#18986Cropping gif images
Description
Hi
I wanted to crop my gif’s into squares, using the ‘c’ operator.
10.file.width = 53c
10.file.height = 53c
The problem is, as explained on this image magick page:
http://www.imagemagick.org/Usage/crop/
“The size of the displayed image (its ‘virtual canvas’ or page size) has not been effected by the “-crop” operation. The actual image itself has been cropped, and may be smaller, but the canvas on which the GIF image is displayed is still the same size as the original canvas.”
This resulted in a gif like this, with the cropped away area being transparent, but still there:
http://www.imagemagick.org/Usage/crop/crop.gif
I tried all sort of params on the image, +repage and -page 0×0+0+0 and so on, but nothing fixed it. I got tired of trying to find a good solution, so I just changed the code in class.t3lib_stdgraphic.php.
Original line 2189 in class.t3lib_stdgraphic.php:
$params .= ‘ -crop ‘.$data[‘origW’].‘x’.$data[‘origH’].‘‘.$offsetX.’’.$offsetY.’ ‘;
I added an exclamation mark:
$params .= ‘ -crop ‘.$data[‘origW’].‘x’.$data[‘origH’].‘‘.$offsetX.’’.$offsetY.’! ‘;
changing the IM-command from:
convert -geometry 53×80! -colors 64 -crop 53×53+0+13 orig.gif new.gif
to:
convert -geometry 53×80! -colors 64 -crop 53×53+0+13! orig.gif new.gif
Sorry if the explanation is a bit lacking, if you have any questions I will try my best to answer.
ImageMagick 6.2.5
(issue imported from #M8763)
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.