Version: ImageMagick 6.6.7-10 2011-02-25 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features:
Mac OSX Tiger
It appears that -trim fails with the following GIF image:
convert -size 400x400 xc:white -gravity center -background black -extent 600x600 test1.gif
convert test1.gif -trim test2.gif
the result is not trimmed.
It works fine if I convert the gif to tiff and then trim
convert test1.gif test1.tiff
convert test1.tiff -trim test2.tiff
possible bug with -trim and GIF IM 6.6.7.10 Q16
Re: possible bug with -trim and GIF IM 6.6.7.10 Q16
We tried your commands under ImageMagick 6.6.7-10 Fedora 14 and we get the expected results:
- compare -metric rmse test2.gif test2.tiff null:
0 (0)
Re: possible bug with -trim and GIF IM 6.6.7.10 Q16
I think you forgot "repage".fmw42 wrote:convert test1.gif -trim test2.gif

convert test1.gif -trim +repage test2.gif
Re: possible bug with -trim and GIF IM 6.6.7.10 Q16
By the way.. Trim IS failing with such images - but only sometimes (and not trim is at fault there, but the color reduction in GIF). The problem in these threads is still present:
viewtopic.php?f=3&t=16162
viewtopic.php?f=3&t=16190
Take the example from that first thread: When saving as GIF, the color reduction/dithering there reduces the colors (unnecessarily, as there are already less than 256 colors). Which leads to small changes in the formerly solid-color border. Which leads to trim not working (without fuzz).
I think the best workaround is still adding an explicit "+dither -colors 256" when saving images (which have less than 256 colors) as GIF.
viewtopic.php?f=3&t=16162
viewtopic.php?f=3&t=16190
Take the example from that first thread: When saving as GIF, the color reduction/dithering there reduces the colors (unnecessarily, as there are already less than 256 colors). Which leads to small changes in the formerly solid-color border. Which leads to trim not working (without fuzz).
I think the best workaround is still adding an explicit "+dither -colors 256" when saving images (which have less than 256 colors) as GIF.

- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: possible bug with -trim and GIF IM 6.6.7.10 Q16
Drarakel wrote:I think you forgot "repage".fmw42 wrote:convert test1.gif -trim test2.gif![]()
convert test1.gif -trim +repage test2.gif
Right you are! DOH!
