Detailed information and examples are available for each script on separate pages linked above and below as well as a summary list of them all.



You can also try many of them in an interactive environment at JqMagic. This is a collaborative effort with Jd Audibert.



To download a script, go the examples page for that script and simply click on the link. The links are controlled by a counter script and are set to download automatically upon a single left button click.



These scripts are bash unix shell scripts and should work on Linux and Mac OSX with IM 6.3.5.0 or higher. Note that they were not designed for multi-page/multi-layer/multi-frame images .



Pointers for use: Be sure you have installed the unix calculator, bc. It is an option that you may have to select when installing unix. Download the script Change the name to remove the suffix .dms (if it exists) and optionally replace with .sh Set the script to executable (chmod u+x) Find the full path to where IM (convert) resides by typing in a shell terminal window: type -a convert If type -a convert returns more than one path, type in a shell terminal window: path2/convert -version, where path2 is each of the paths found. Decide which version of IM you want to use. Modify your PATH environment variable so that it includes the full path to where IM (convert) resides (often /usr/bin or /usr/local/bin). This can be done by editing your .profile file.

Alternately, edit the script somewhere between the comments and the first use of any IM command, such as just below the defaults section to add the following two lines:

imdir="path2" #(such as imdir="/usr/local/bin" or imdir="/usr/bin")

PATH="${imdir}:${PATH}" Open a shell terminal window SYNTAX: bash /fullpathto/scriptname(.sh) arguments /fullpathto/inputimage /fullpathto/outputimage To avoid the bash and just use scriptname(.sh) ... set your PATH to contain the location of the script. I strongly suggest you create a directory to contain all my scripts and put the path to that directory in your PATH environment variable. That will also avoid issues for scripts that make calls to any of my other scripts and also messages regarding locating my scripts. Optionally edit the script to change the default directory (found after the defaults section) from dir="." to dir="/tmp" and be sure it has read/write permissions. If you have trouble with filenames with spaces in them, then you will need to edit the script in several places until I have time to review and fix all my scripts. Find where infile and outfile (maskfile or any others) are defined at the end of the argument trapping section. Make sure to enclose in double quotes any declarations of those files that include $1, $2, etc, such as infile="$1", etc Find any occurrences of $infile or $outfile and enclose them in double quotes as "$infile", etc. On some Linux systems, there may be an issue with duplicate lines of documentation when using the -help option. If this is the case, try changing the following two lines in functions usage1() and usage2(), respectively, just below the commented section at the top of the script as follows (suggested by Stefan Vorkoetter and Ted Baker):



sed >&2 -e '1,/^####/d; /^###/g; /^#/!q; s/^#//; s/^ //; 4,$p' "$PROGDIR/$PROGNAME"

To:

sed -e '1,/^####$/d; /^###$/,$d; s/^#//; s/^ //' "$PROGDIR/$PROGNAME" sed >&2 -e '1,/^####/d; /^######/g; /^#/!q; s/^#*//; s/^ //; 4,$p' "$PROGDIR/$PROGNAME"

To:

sed -e '1,/^####$/d; /^######$/,$d; s/^#*//; s/^ //' "$PROGDIR/$PROGNAME"

or



sed >&2 -n -e '1,/^####/d; /^###/g; /^#/!q; s/^#//; s/^ //; 4,$p' "$PROGDIR/$PROGNAME"

To:

sed -e '1,/^####$/d; /^###$/,$d; s/^#//; s/^ //' "$PROGDIR/$PROGNAME" sed >&2 -n -e '1,/^####/d; /^######/g; /^#/!q; s/^#*//; s/^ //; 4,$p' "$PROGDIR/$PROGNAME"

To:

sed -e '1,/^####$/d; /^######$/,$d; s/^#*//; s/^ //' "$PROGDIR/$PROGNAME" Many of my scripts use the Unix tool AWK for processing. On some Linux systems, AWK is not available and

loads a different type of AWK, which does not work properly. Loading GAWK onto your system seems to resolve this issue. AWK then makes use of GAWK.

. Pointers for use:

These scripts can be used with PHP exec command.



Pointers for use: Be sure you have installed the unix calculator, bc. It is an option that you may have to select when installing unix. Download the script Change the name to remove the suffix .dms (if it exists) and optionally replace with .sh Set the script to executable (chmod u+x) Find the full path to where IM (convert) resides by typing in a shell terminal window: type -a convert If type -a convert returns more than one path, type in a shell terminal window: path2/convert -version, where path2 is each of the paths found. Decide which version of IM you want to use. Modify your PATH environment variable so that it includes the full path to where IM (convert) resides (often /usr/bin or /usr/local/bin). This can be done by editing your .profile file.

Alternately, edit the script somewhere between the comments and the first use of any IM command, such as just below the defaults section to add the following two lines:

imdir="path2" #(such as imdir="/usr/local/bin" or imdir="/usr/bin")

PATH="${imdir}:${PATH}" Edit the script to change the default directory (found after the defaults section) from dir="." to dir="/tmp" and be sure it has read/write permissions. In the exec command use bash /fullpathto/scriptname(.sh) arguments /fullpathto/inputimage /fullpathto/outputimage.

Note that "bash" may or may not be necessary To avoid the bash and just use scriptname(.sh) ... set your PATH to contain the location of the script. I strongly suggest you create a directory to contain all my scripts and put the path to that directory in your PATH environment variable. That will also avoid issues for scripts that make calls to any of my other scripts and also messages regarding locating my scripts. If you have trouble with filenames with spaces in them, then you will need to edit the script in several places until I have time to review and fix all my scripts. Find where infile and outfile (maskfile or any others) are defined at the end of the argument trapping section. Make sure to enclose in double quotes any declarations of those files that include $1, $2, etc, such as infile="$1", etc

Find any occurrences of $infile or $outfile and enclose them in double quotes as "$infile", etc.

For FreeBSD users, if the script does not run, you may need to change the first line of code at the top of my scripts: From: #!/bin/bash



To: #!/usr/bin/env bash

Windows users can run my scripts, if they install the unix Cygwin system for Windows and then install the IM Cygwin binary.



A very detailed description of Cygwin installation, relevant script syntax and examples has been provided by user snibgo on his web site at http://im.snibgo.com/cygwin.htm. A brief outline that he wrote can be found at http://www.imagemagick.org/discourse-server/viewtopic.php?f=26&t=25910&start=30#p113836. Many thanks to snibgo for this excellent document.



Another guide to using bash shell scripts under Cygwin on Windows has been provided by Wolfgang Hugemann in his excellent page, Usage Under Windows

Windows 10 (64-bit) users can also run my scripts without the need for Cygwin. Bruce Rusk reports: All that was need was the installation of the Unix bc tool and Imagemagick through apt/apt-get. Everything else worked right out of the box, no changes to PATH variables required. See How to Install and Use the Linux Bash Shell on Windows 10.

My earliest scripts were developed under ImageMagick-6.3.5.0 on Mac OS 10.4x. I have tried to keep them updated with changes in IM versions. All were developed using Q16 IM. I do not know how compatible they are to older version of ImageMagick, nor to other Q levels or other versions of Unix. NOTE: Starting with IM 6.3.5.7, -matte/+matte were deprecated in favor of -alpha set or on/-alpha off. Therefore, many of my scripts may not work with IM versions prior to that unless replaced with the deprecated syntax.

Use at your own risk. The argument testing may not be foolproof nor do I bear any responsibility for any problems that may occur by their use.

I would like to thank Anthony Thyssen for his patience with all my newbie questions about IM and Unix. His replies were invaluable.

My background involves image processing with a specialty in image perspective transformations from arial photography. For details, see my personal information page.

I have also written a digital image filtering tutorial (2MB PDF). It supplements the description of the following scripts below with more mathematical detail: binomial, derivative, gradient, laplacian, statsfilt, isonoise, sharp and space.

And I have created a tutorial for Fourier Transform Processing With ImageMagick. It supplements the description of the following scripts below with more mathematical detail: spectrum, fftconvol, fftdeconvol, fftfilter, cepstrum, camerablur, cameradeblur, normcrosscorr and notch.

Also see my ImageMagick Tidbits pages.

Comments and bug reports are always welcome. My contact information is fmw at alink dot net

If you find any of these scripts are particularly useful, please let the folks at ImageMagick know. Perhaps they will consent to implement them as IM functions.

NOTE: I fix problems that I find with the scripts or make improvements often. So please check the last modified dates below or the revision dates in the scripts for updates. Latest Updates: unsaturatehue: Aug 17, 2020 - added new script to desaturate a given hue (range) in an image.

midgradient: May 14, 2020 - added new script to create a two-color gradient with adjustable mid-color location.

whitebalancing: Mar 31, 2020 - added new script to apply white balancing to an image according to a gray world method.

unrotate2: Oct 3, 2019 - added new script to automatically unrotate a rotated image and trim the surrounding border.

trim2detail: Aug 24, 2019 - added new script to trim an image to the bounding rectangle about the image's main content.

rangethresh: Aug 16, 2019 - added new script to convert an image to binary using range values for each channel of the input.

textetch: Aug 15, 2019 - added new script to add text to an image to simulate etching on glass.

shapecompare: Aug 9, 2019 - added new script to compare two images' shapes using metrics computed from Hu image moments.

bokeh: May 19, 2019 - added new script to apply a bokeh blurring effect to an image.

typewriter: May 5, 2019 - added new script to create a typewriter style text animation.

greenscreen: Apr 30, 2019 - added new script to remove background green color in a green screen image.

crystallize: Apr 25, 2019 - modified to add new script to create random crystal-like regions in an image.

tshirt: Jan 4, 2019 - modified to add scale option to fit argument and also image opacity.

cylinderize: Dec 31, 2018 - modified to add mode to compute wrap amount for no aspect change of input image.

trim2rect: Dec 29, 2018 - added new script to trim the sides of an image until no outer row/column contains background color.

adaptivegamma2: Dec 2, 2018 - added new script to enhance the contrast/brightness in an image using an adaptive gamma method.

scriptbatch: Oct 27, 2018 - added new script to run another script over a folder of images.

videoglitch: Sep 29, 2018 - added new script to apply a video glitch effect to an image.

xpand: Sep 18, 2018 - added new script to apply a non-uniform outward stretch of the image in one direction.

woodbrand: Sep 2, 2018 - added new script to create a branded effect in a wood grain image using a binary image as the brand.

surroundblur: Aug 20, 2018 - added new script to create a blurred background region around the input image.

zoomrotatetext: Aug 8, 2018 - added new script to create a zoomed rotating text animation.

vibrance3: Jul 28, 2018 - added new script to apply a non-linear change to the chroma channel of an image.

sinescrollimage: Jul 27, 2018 - added new script to create a sinusoidal curved scrolling image banner animation.

sinescrolltext: Jul 26, 2018 - added new script to create a sinusoidal curved scrolling text banner animation.

wiggle: Jul 21, 2018 - added new script to create a sinusoidal wiggling animation.

scalescroll: Jul 20, 2018 - added new script to create a scaled scrolling animation.

shimmer: Jul 17, 2018 - added new script to create a reflected heat shimmering effect animation.

xtract: Jul 16, 2018 - added new script to use Hough lines to extract and rectify a quadrilateral area from an image.

rgbdots: May 25, 2018 - added new script to transform an image into dots in primary and secondary colors.

hamming: May 2, 2018 - added new script to compute the hamming distance between two binary string perceptual hashes.

phashes: May 2, 2018 - added new script compute and store one or more perceptual hashes for all provided images.

polyring: Feb 28, 2018 - added new script to create a polygon ring image from one or more images.

shadows: Feb 23, 2018 - added new script to apply drop shadows to an image that has an alpha channel.

outfitwarper: Jan 6, 2018 - added new script to transform a pattern image onto an image of some piece of clothing or outfit.

outfit: Jan 3, 2018 - added new script to transform a pattern image onto an image of some piece of clothing or outfit.

The following scripts are superseded by newer IM functions: Superceded Scripts: adjoin script is superceded by IM -append

anglegradient script is superceded multigradient script

autogamma script is superceded by IM -auto-gamma

autolevel script is superceded by the sequence of IM -auto-level -auto-gamma

bcimage script is superceded by IM -brightness-contrast

bilinearwarp script is superceded by IM -distort bilinearforward

fisheye2pano script is mostly superceded by IM -distort depolar

flicker script is superceded by Anthony's script flicker_cmp

levelcolors script is superceded by IM -level-colors

moments script is superceded by IM identify -verbose -moments (IM 6.8.8.2)

morphology script is superceded by IM -morphology

pinbarrel script is superceded by IM -distort barrel and -distort barrelinverse

polar script is superceded by IM -distort polar and -distort depolar

profile script is superceded by Anthony's script im_profile

saturation script is superceded by IM -modulate

separate script is superceded by IM -connected-components

similar script is superceded by IM compare -metric ncc

skew script is superceded by IM -shear

ssim script is superceded by IM compare -metric ssim

stretch script is superceded by IM -auto-level