Fred's ImageMagick Scripts



    Licensing:

    Copyright © Fred Weinhaus

    My scripts are available free of charge for non-commercial 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

MELT


Creates a melting-like blur effect in an image.

Download Script

last modified: September 26, 2017



USAGE: melt [-l length] [-d direction] [-b blur] infile outfile
USAGE: melt [-h or -help]

-l .... length ....... length of melt effect; integer>0
-d .... direction .... direction of melt; North,South,East,West
...................... default=South
-b .... blur ......... initial blur amount; float>=0; default=0

PURPOSE: To create a melting-like blur effect in an image.

DESCRIPTION: MELT creates a melting-like blur effect in an image using an iterative offset and compare technique. The brighter of the comparison values will be used.

ARGUMENTS:

-l length ... LENGTH is the melt distance. Values are integers greater than 0. The default is 10. The length determines the number of iterations.

-d direction ... DIRECTION is the melt direction. Values may be North, South, East, West (or abbreviations N,S,E,W). The default=South

-b blur ... BLUR is an initial blurring of the image to make the pixels wider before applying the melting process. Values for blur are floats>=0. Typical values are a few pixels. The default=0.

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


Image Melt
http://www.cescg.org/CESCG97/boros/

Original

Arguments:
-l 10 -d South

Arguments:
-l 10 -d East



What the script does is as follows:

  • Shifts the image by one pixel in the desired direction
  • Compares the original with the shifted image
  • Selects the brighter value from the two images
  • Iterates the desired number of times determined by the specified length

This is equivalent to the following IM commands for melt in the South direction.

  • ww=`convert $infile -format "%w" info:`
  • hh=`convert $infile -format "%h" info:`
  • ww1=`expr $ww - 1`
  • hh1=`expr $hh - 1`
  • sub1="${ww}x1+0+0"
  • sub2="${ww}x${hh1}+0+0"
  • convert $infile $tmpA
  • convert $tmpA[$sub1] $tmpA[$sub2] -append $tmpC
  • i=0
  • while [ $i -lt $iter ]
  • do
  • convert $tmpA $tmpC -compose lighten -composite $tmpA
  • convert $tmpA[$sub1] $tmpA[$sub2] -append $tmpC
  • i=`expr $i + 1`
  • done
  • convert $tmpA $outfile