If adding a static color background (white, transparency etc) the image will compress (very very well), however a non-static background will not compress very well.
However with the example
1/ You should ensure the animation is 'coalasced' before composition to remove any existing optimisations
2/ Use -layers Optimize before saving. That should include both frame optimization, and transparency optimization
3/ you do not need to set dispose is you are optimizing as that assumes the image is already coalesced.
I do not believe OptimizePlus will help this animation very much.
Code: Select all
convert banner.gif null: \( worm.gif -coalesce \) \
-layers composite -layers optimize result.gif
BUT something is failing somewhere! as it is setting a disposal of 'none' when it is clear that the disposal of a should be background for at least some of the frames.
So this is working, though it is not optimized
Code: Select all
convert banner.gif null: \( worm.gif -coalesce \) \
-layers composite -set dispose background result.gif
Something in the low level functions is really going wrong!
however after a bit of play and simple image warping I get this..
Code: Select all
convert worm_banner.gif -trim +repage -resize 220x220\! null: \
\( worm.gif -coalesce -gravity south -chop 0x1 \
-background none -wave 13x200 -shear 0x-4 \) \
-gravity center -geometry +1-16 -layers composite \
-layers optimizeframe worm_result.gif
No optimization problems due to clean (from resize) and static transparency.
More exact image warping can be done by using a hand created distortion map.
Or perhaps a different order of rotations, wave and shears will get the worm to follow the banner more closely.
To at wave applied at an angle, rotate the image then apply wave, and rotate shear into place. What I did was just a quick 'try until you get reasonably close' iteration.
Alturnativally, leave the background, and resize - distort and mask the work onto the banner (-compose ATop). that way edges of the banner is left as is, worm animation is clipped to the banner, and as it is not involving boolean transparency, you get good anti-aliased edges to the worm!