Skip to content

Animated wipe

Animated wipes with ImageMagick

To generate the animated GIF of a smooth wipe between these two images, I used the convert command from ImageMagick:

convert \
       -loop 0 \
       -delay 5 \
       image1.jpg \
       \( image2.jpg -crop 10x0 \) \
       \( -clone 0 -crop 10x0 -reverse \) \
       output.gif

The -loop 0 -delay 5 says to loop forever and to delay 50 ms between images, which is 20fps.

The -crop 10x0 controls the wipe speed and direction. This wipes 10 pixels in the X direction and none in the Y direction. If you want to wipe top to bottom, use -crop 0x10. If both an X and Y are specified it does a checkerboard wipe that doesn't look as good.

The -clone 0 reuses the first frame and the -reverse makes the wipe go right to left.

The label overlays were also added with ImageMagick - this could be done as part of the animation command if you wanted to avoid creating temp files:

convert \
        -fill white \
        -background '#0008' \
        -geometry +800+20  \
        -size 100x50 \
        caption:'2009' \
        image1.jpg \
        +swap \
        -composite \
        image1-label.jpg

2018 Hacks


Last update: November 8, 2020