Original images:


Coalesce
Equivalent to a call to the -coalesce operator. Apply the layer disposal methods set in the current image sequence to form a fully defined animation sequence, as it should be displayed. Effectively converting a GIF animation into a 'film strip'-like animation.

convert images/test_ani.gif -layers Coalesce +repage Coalesce.png


CompareAny
Crop the second and later frames to the smallest rectangle that contains all the differences between the two images. No GIF -dispose methods are taken into account.
This exactly the same as the -deconstruct operator, and does not preserve animations normal working, especially when animation used layer disposal methods such as 'Previous' or 'Background'.

convert images/test_ani.gif -layers CompareAny +repage CompareAny.png



CompareClear - other 12 images are 1x1 pngs!
As 'compare-any' but crop to the bounds of any opaque pixels which become transparent in the second frame. That is the smallest image needed to mask or erase pixels for the next frame.

convert images/test_ani.gif -layers CompareClear +repage CompareClear.png



CompareOverlay
As 'compare-any' but crop to pixels that add extra color to the next image, as a result of overlaying color pixels. That is the smallest single overlaid image to add or change colors.
This can be used with the -compose alpha composition method 'change-mask', to reduce the image to just the pixels that need to be overlaid.

convert images/test_ani.gif -layers CompareOverlay +repage CompareOverlay.png



Dispose - just gave blank images on the simple gif animation
This like 'coalesce' but shows the look of the animation after the layer disposal method has been applied, before the next sub-frame image is overlaid. That is the 'dispose' image that results from the application of the GIF -dispose method. This allows you to check what is going wrong with a particular animation you may be developing.

convert ../morph.gif -layers Dispose +repage Dispose.png



Flatten
Create a canvas the size of the first images virtual canvas using the current -background color, and -compose each image in turn onto that canvas. Images falling outside that canvas is clipped. Final image will have a zero virtual canvas offset.
This usally used as one of the final 'image layering' operations overlaying all the prepared image layers into a final image.
For a single image this method can also be used to fillout a virtual canvas with real pixels, or to underlay a opaque color to remove transparency from an image.

convert -background skyblue 0.png 1.png 2.png 3.png -layers flatten +repage Flatten.png



Merge
As 'flatten' method but merging all the given image layers into a new layer image just large enough to hold all the image without clipping or extra space. The new images virtual offset will prevere the position of the new layer, even if this offset is negative. the virtual canvas size of the first image is preserved.
Caution is advised when handling image layers with negative offsets as few image file formats handle them correctly.

convert -background skyblue 0.png 1.png 2.png 3.png -layers merge +repage Merge.png



Mosaic
As 'flatten' method but expanding the initial canvas size of the first image so as to hold all the image layers. However as a virtual canvas is 'locked' to the origin, by defination, image layers with a negative offsets will still be clipped by the top and left edges.
This method is commonly used to layout individual image using various offset but without knowning the final canvas size. The resulting image will, like 'flatten' not have any virtual offset, so can be saved to any image file format.

convert -background skyblue 0.png 1.png 2.png 3.png -layers Mosaic +repage Mosaic.png



Optimize - Something going wrong here!
Optimize a coalesced animation, into GIF animation using a number of general techniques. This currently a short cut to apply both the 'optimize-frame', and 'optimize-transparency' methods but may be expanded to include other optimization methods as they are developed.

convert images/test_ani.gif -layers OptimizeFrame +repage Optimize.gif



OptimizeFrame
Optimize a coalesced animation, into GIF animation by reducing the number of pixels per frame as much as possible by attempting to pick the best layer disposal method to use, while ensuring the result will continue to animate properly.
There is no guarantee that the best optimization is found. But then no reasonably fast GIF optimization algorithm can do this. However this does seem to do better than most other GIF frame optimizers seen.

convert images/test_ani.gif -layers OptimizeFrame +repage OptimizeFrame.png



OptimizePlus
As 'optimize-frame' but attempt to improve the overall optimization by adding extra frames to the animation, without changing the final look or timing of the animation. The frames are added to attempt to separate the clearing of pixels from the overlaying of new additional pixels from one animation frame to the next. If this does not improve the optimization (for the next frame only), it will fall back to the results of the previous normal 'optimize-frame' technique.
There is the possibility that the change in the disposal style will result in a worsening in the optimization of later frames, though this is unlikely. In other words there no guarantee that it is better than the normal 'optimize-frame' technique. For some animations however you can get a vast improvment in the final animation size.

convert images/test_ani.gif -layers OptimizePlus +repage OptimizePlus.png



OptimizeTransparency
Given a GIF animation, replace any pixel in the sub-frame overlay images with transparency, if it does not change the resulting animation by more than the current -fuzz factor.
This should allow a existing frame optimized GIF animation to compress into a smaller file size due to larger areas of one (transparent) color rather than a pattern of multiple colors repeating the current disposed image of the last frame.

convert ../morph.gif -fuzz 3% -layers OptimizeTransparency +repage OptimizeTransparency.png



RemoveDups
Remove (and merge time delays) of duplicate consecutive images, so as to simplify layer overlays of coalesced animations.
Usually this a result of using a constant time delay across the whole animation, or after a larger animation was split into smaller sub-animations. The duplicate frames could also have been used as part of some frame optimization methods.

convert images/test_ani.gif -layers RemoveDups +repage RemoveDups.png



RemoveZero
Remove any image with a zero time delay, unless ALL the images have a zero time delay (and is not a proper timed animation, a warning is then issued).
In a GIF animation, such images are usually frames which provide partial intermediary updates between the frames that are actually displayed to users. These frames are usally added for improved frame optimization in GIF animations.

convert images/test_ani.gif -layers RemoveZero +repage RemoveZero.png



TrimBounds
Find the bounds of all the images in the current image sequence, then adjust the offsets so all images are contained on a minimal positive canvas. None of the image data is modified, only there virtual canvas size and offset. The all the image is given the same canvas size, and and will have a positive offset, but will remain in the same position relative to each other. As a result of the minimal canvas size at least one image will touch every edge of that canvas. The image data however may be transparent.

convert images/test_ani.gif -layers TrimBounds +repage TrimBounds.gif