I've done only some very basic stuff with ImageMagick (mainly resizing, also messing with color filters a bit).
Imagemagick has a simple example for overlaying images:
convert anthony_1.jpg anthony_2.jpg -average anthony_ghosts.jpg
But I have no idea how to do this in an animated way. An example (with explanation) for ImageMagick or another program would be appreciated.