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

SCALESCROLL


Creates a scaled scrolling animation.

Download Script

last modified: July 20, 2018



USAGE: scalescroll [-f frames] [-d delay] [-D direction] infile outfile
USAGE: scalescroll [-h or -help]

-f ... frames ...... number of frames to generate in the animation; integer>0;
.................... default=25
-d ... delay ....... animation delay between frames; integer>0; default=20
-D ... direction ... direction of the scrolling; choices are: left, right, up, down;
.................... default=right

PURPOSE: Creates a scaled scrolling animation.

DESCRIPTION: SCALESCROLL creates scaled scrolling animation. The scaling increase from one side and decreases from the other side. The scrolling can be either to the right, left, up or down directions.

ARGUMENTS:

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

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

-D direction ... DIRECTION of the scrolling; choices are: left (l), right (r), up (u), down (d). The default=right

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


Example 1

Original:
(source)

Arguments:
-D right

Arguments:
-D left

Arguments:
-D up

Arguments:
-D down



Example 2

Original:

convert -size 600 -font ubuntu \
label:"THIS IS A SCALESCROLL TEST" \
-bordercolor white -border 50x0 text.jpg

Arguments:
-D right

Arguments:
-D left

Arguments:
-D up

Arguments:
-D down



What the script does is as follows:

  • Processes the following in loop over the scaling amount
  • Reads the input image
  • Scales the image increasing in a given dimension
  • Scales the image decreasing in a given dimension
  • Appends the two images together
  • Collects the results for each iteration in a miff: file
  • Converts the miff: file to a GIF aniimation
  • Writes the aniimation to the output file

This is equivalent to the following IM commands for the case of direction=right

  • ww=`convert -ping "$infile" -format "%w" info:`
  • (
    incr=`convert xc: -format "%[fx:round($ww/$frames)]" info:`
    for ((k=0; k dim1=$((k*incr))
    dim2=$((ww-dim1))
    if [ $dim1 -eq 0 ]; then
    convert "$infile" miff:-
    else
    convert \( "$infile" -scale ${dim1}x! \) \( "$infile" -scale ${dim2}x! \) +append miff:-
    fi
    done
    ) | convert -delay 20 - -loop 0 "$outfile"