Fred's ImageMagick Scripts



    Licensing:

    Copyright © Fred Weinhaus

    My scripts are available free of charge for non-commercial (non-profit) use, ONLY.

    For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net.

    If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment.

    Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php

    Please read the Pointers For Use on my home page to properly install and customize my scripts.

SHIMMER


Creates a reflected heat shimmering effect animation.

Download Script

last modified: December 15, 2018



USAGE: shimmer [-f frames] [-d delay] [-r rate] [-a amount] [-F fcolor] infile outfile

USAGE: shimmer [-h or -help]

-f ... frames ... number of frames to generate in the animation; integer>0; default=15
-d ... delay .... animation delay between frames; integer>0; default=5
-r ... rate ..... rate of change in chirp wavelength; integer>0; default=3
-a ... amount ... displacement amount; integer>0; default=10
-F ... fcolor ... fade color for the reflection; any valid opaque IM color is
................. allowed; default=no fade; typical color is white.

PURPOSE: Creates a reflected heat shimmering effect animation.

DESCRIPTION: SHIMMER creates a reflected heat shimmering effect animation.

ARGUMENTS:

-f frames ... FRAMES are the number of frames to generate in the animation. Value are integers>0. The default=15.

-d delay ... DELAY is animation delay between frames in ticks. Values are integers>0. The default=5.

-r rate ... RATE of change in the chirp distortion to be applied. Values are integers>0. A chirp is a sinusoidal wave whose wavelength/frequency changes as a function of distance along the wave. The rate value is the exponent used in the chirp equation. Larger values ramp the chirp faster. The default=3.

-a amount ... AMOUNT of displacement. Values are integers>0. The default=10.

-F fcolor ... FCOLOR is the fade color for the reflection. Any valid opaque IM color is allowed. Te default=no fade. Typical color is white.

REFERENCE: https://en.wikipedia.org/wiki/Chirp

CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk.


EXAMPLES


Original:
(source)

Arguments:
-r 1

Arguments:
-r 2

Arguments:
-r 3
(defaults)

Arguments:
-r 4

Arguments:
-r 3 -F white

Arguments:
-r 3 -F gray

Arguments:
-r 3 -F black



What the script does is as follows:

  • Processed the following in loop over the sinusoidal phase
  • Reads the input image
  • Creates a chirp sinusoidal distort image
  • Applies the distortion and flips the image
  • Appends the original above the distorted image
  • Writes the output

This is equivalent to the following IM commands

  • (
    for ((k=0; k convert $tmp1A -write mpr:img \
    \( -size 1x${hh} xc: -fx "0.5*sin($k*2*pi/$frames+2*pi*(j/(0.5*h))^$rate)+0.5" -scale ${ww}x${hh}! \) \
    -define compose:args=0,$amount -compose displace -composite -flip \
    mpr:img +swap -append miff:-
    done
    ) | convert -delay $delay - -loop 0 "$outfile"