Trimming animated gif

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
double
Posts: 14
Joined: 2009-10-25T10:12:06-07:00
Authentication code: 8675309

Trimming animated gif

Post by double »

Hello,

This bug report belongs to this item:
viewtopic.php?f=1&t=17032

Testcase (47x29 pixels, coalesced):

Code: Select all

wget http://doppelbauer.name/test.gif
convert -verbose test.gif -layers optimize optimized.gif
identify optimized.gif
The problem, optimized.gif[2] is a full image (47x29 pixels), but only the left 31
pixels contain a non-transparent color. Therefore TrimBounds won't work.

Code: Select all

optimized.gif[0] GIF 31x29 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[1] GIF 9x3 47x29+12+6 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[2] GIF 47x29 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[3] GIF 32x29 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[4] GIF 35x28 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[5] GIF 32x29 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[6] GIF 31x29 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[7] GIF 32x29 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[8] GIF 35x28 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[9] GIF 32x29 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[10] GIF 31x29 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[11] GIF 32x29 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[12] GIF 35x28 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[13] GIF 32x29 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[14] GIF 31x29 47x29+0+0 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
optimized.gif[15] GIF 9x3 47x29+12+6 8-bit PseudoClass 64c 9.46KiB 0.000u 0:00.000
Thanks
Marcus
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Trimming animated gif

Post by anthony »

This is a known problem, and one I have not had time to work on.

The bug is deep in the code, where at some point the frame comparison thinks two frames are completely different when that is definitely not the case. In my testing (last time I tried to track it down) it thought they were different even when the two frames are actually identical 'clones' of each other.

It was working when I first wrote the code, and nothing has changed in the code I wrote, but the comparison is failing! I posted a bug report about it at that time.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Trimming animated gif

Post by magick »

We're using ImageMagick 6.6.5-10, the current release. It appears to behave properly. We're getting:
  • optimized.gif[0] GIF 31x29 47x29+0+0 8-bit PseudoClass 64c 9.45KB 0.000u 0:00.000
    optimized.gif[1] GIF 9x3 47x29+12+6 8-bit PseudoClass 64c 9.45KB 0.000u 0:00.000
    optimized.gif[2] GIF 19x6 47x29+12+6 8-bit PseudoClass 64c 9.45KB 0.000u 0:00.000
    optimized.gif[3] GIF 32x29 47x29+0+0 8-bit PseudoClass 64c 9.45KB 0.000u 0:00.000
double
Posts: 14
Joined: 2009-10-25T10:12:06-07:00
Authentication code: 8675309

Re: Trimming animated gif

Post by double »

You are right - sorry for disturbing.
Markus
Post Reply