I was about to suggest that too when I saw that
snibgo already did.
Good work!
The change mask is the better solution and also understands the use of -fuzz to also match near-colors. However it is a 'boolean' transparency, Pixels are either left as is, or set to be transparent. Remember the 'destination' image (first image in "convert") is the one that will have its unchanged pixels preserved
You can however do it all in one command
Code: Select all
convert A.gif B.gif -compose Change-mask -composite \
-background black -flatten C.gif
For more info. IM Examples, Compositing Images, Special Composition Methods, ChangeMask
http://www.imagemagick.org/Usage/compose/#changemask
This is also one of few compose methods which does not actually replace the colors within the
image. It only makes the colors transparent. However saving to GIF will loose that information.
That means an alternative way of setting the unchanged pixels to black is..
Code: Select all
convert A.gif B.gif -compose Change-mask -composite \
-background black -alpha background -alpha off C.gif
See IM Examples, Basics, transparency Handling, Alpga Background
http://www.imagemagick.org/Usage/basics ... background
It was originally designed to convert unchanged colors to transparency, as a optimization for GIF Animations (
-layers OptimizeTransparency )
See IM examples, Gif Optimizations, Transparency Optimization
http://www.imagemagick.org/Usage/anim_opt/#opt_trans