possible bug with -trim and GIF IM 6.6.7.10 Q16

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

possible bug with -trim and GIF IM 6.6.7.10 Q16

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: possible bug with -trim and GIF IM 6.6.7.10 Q16

Post 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.
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: possible bug with -trim and GIF IM 6.6.7.10 Q16

Post by Drarakel »

fmw42 wrote:convert test1.gif -trim test2.gif
I think you forgot "repage". :wink:
convert test1.gif -trim +repage test2.gif
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: possible bug with -trim and GIF IM 6.6.7.10 Q16

Post 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. :?
User avatar
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

Post by fmw42 »

Drarakel wrote:
fmw42 wrote:convert test1.gif -trim test2.gif
I think you forgot "repage". :wink:
convert test1.gif -trim +repage test2.gif

Right you are! DOH! :oops:
Post Reply