Page 1 of 1
possible bug with -trim and GIF IM 6.6.7.10 Q16
Posted: 2011-02-26T11:04:08-07:00
by fmw42
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
Re: possible bug with -trim and GIF IM 6.6.7.10 Q16
Posted: 2011-02-26T11:16:00-07:00
by magick
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)
We're not sure why its failing for you.
Re: possible bug with -trim and GIF IM 6.6.7.10 Q16
Posted: 2011-02-26T11:37:37-07:00
by Drarakel
fmw42 wrote:convert test1.gif -trim test2.gif
I think you forgot "repage".
convert test1.gif -trim +repage test2.gif
Re: possible bug with -trim and GIF IM 6.6.7.10 Q16
Posted: 2011-02-26T13:12:09-07:00
by Drarakel
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.
Re: possible bug with -trim and GIF IM 6.6.7.10 Q16
Posted: 2011-02-26T13:54:00-07:00
by fmw42
Drarakel wrote:fmw42 wrote:convert test1.gif -trim test2.gif
I think you forgot "repage".
convert test1.gif -trim +repage test2.gif
Right you are! DOH!