The command here is in Windows command line syntax...
Code: Select all
magick input.jpg ^
-background none ^
-set filename:f "%[t]" ^
-resize %[fx:w-(w%10)]x ^
-dither floydsteinberg ^
-duplicate 9 ^
-virtual-pixel tile ^
-distort affine "0,0 -%[fx:t*(w*0.05)],0" ^
-wave %[fx:min(w,h)*0.01]x%[fx:w*0.5] ^
-distort affine "0,0 %[fx:t*(w*0.05)],0" ^
-set dispose background ^
-set delay 15 ^
-loop 0 ^
"%[filename:f]_wavy.gif"
After all the images in the stack are shifted incrementally, a "-wave" effect is added, then they're all un-shifted back to their original locations. The result is each image in the stack has a wave a little further along than the last. Finish up by setting a delay and output the stack to a GIF named by using the filename of the input image.
Here's another example...
The movement is pretty smooth for only using a stack of ten images, and the output file sizes are relatively small for the amount of visible movement in the animation. More detail in the input image will mean a larger file of course, but a simple image like the flag at the top is under 100k.
To use this in a Windows BAT script would require changing all the single percent signs "%" to doubles "%%". To use it in a *nix shell it requires escaping all the parentheses with backslashes "\", changing all the double quotes to single quotes, and changing all the continued line carets "^" into backslashes "\".