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.
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.
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.