the image.imagemagick.inc file that comes with the Image module appears to have (what I think) is a minor bug -- the crop command does not use the viewport setting (!). This means that cropped gifs and other files which do not discard canvas info post-crop will retain their original size (although image information OUTSIDE of the crop will appear blank) rather than having their overall size reduced. My guess is most people are expecting the latter (I was!).
Fortunately, it's a simple fix. on line 97 of the current image.imagecache.inc file, change:
$filter = ' -crop '. $width .'x'. $height .'+'. $x .'+'. $y;
to
$filter = ' -crop '. $width .'x'. $height .'+'. $x .'+'. $y.'!';
Comments
Comment #1
drewish commentedfound some documentation of what you're describing: http://www.imagemagick.org/script/command-line-options.php#crop
i need to do some testing to make sure that it doesn't adversely change it for other image types.
Comment #2
drewish commentedragaskar, do you have an image i can use to test that the current behavior is incorrect?
Comment #3
ragaskar commentedyep. try scale and cropping the attached to 100x100 ... i believe that any gif that supports transparency will crop incorrectly, but the attached definitely did for me.
Comment #4
drewish commentedgotcha. tested and confirmed the bug. i noticed that the resize also uses the !
could you test out the attached patch?
Comment #5
ragaskar commentedyep, when I get a chance I will update to head and add the patch in. FWIW, that change has been working fine for me over the last week or so, but there is still a small problem that i haven't addressed yet where the background gets cropped to black for transparencies (it looks like it is possible to crop it to transparency, or at least white).
Comment #6
drewish commentedthe patch should also work for the 1.x-dev release as well... i backported all the imagemagick changes.
Comment #7
drewish commentedcommitted to DRUPAL-5 DRUPAL-5--2 and HEAD.
Comment #8
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.