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

ACCENTEDGES


Applies accented edges to an image.

Download Script

last modified: September 26, 2017



USAGE: accentedges [-w width] [-s strength] [-p polarity] [-b blur] [-c cmethod] infile outfile
USAGE: accentedges [-help]

-w ... width ...... width of edges; integer>0; default=1
-s ... strength ... strenght of edges; integer>=0; default=20
-p ... polarity ... polarity of edges; choices are: white or black;
................... default=black
-b ... blur ....... blurring (smoothing) of edges; float>=0; default=0.5
-c ... cmethod .... compose method for blending edges with image; choices
................... are: over or overlay; default=over

PURPOSE: To apply accented edges to an image.

DESCRIPTION: ACCENTEDGES applies accented edges to an image. The edges may be either black or white. The compose method may be either over or overlay for slightly different effects. This script attempts to duplicate some of the features of Photoshop's Accented Edges.

ARGUMENTS:

-w width ... WIDTH of the edges. Values are integers>0. The default=1.

-s strength ... STRENGTH of the edges. Values are integers>=0. The default=20.

-p polarity ... POLARITY of the edges. The choices are: white or black. The default=black.

-b blur ... BLUR is the blurring (smoothing) of the edges. Values are floats>=0. The default=0.5.

-c cmethod ... CMETHOD is the compose method for blending the edges with the image. The choices are: over or overlay. The default=over.

REQUIREMENTS: IM 6.5.9.3 is required due to the use of -morphology edgeout.

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


Variation In Strength

Original Image

Arguments:
-w 1 -s 10 -p black
-b 0.5 -c over

Arguments:
-w 1 -s 20 -p black
-b 0.5 -c over

Arguments:
-w 1 -s 30 -p black
-b 0.5 -c over

Arguments:
-w 1 -s 40 -p black
-b 0.5 -c over

Arguments:
-w 1 -s 100 -p black
-b 0.5 -c over

Original Image

Arguments:
-w 1 -s 10 -p black
-b 0.5 -c overlay

Arguments:
-w 1 -s 20 -p black
-b 0.5 -c overlay

Arguments:
-w 1 -s 30 -p black
-b 0.5 -c overlay

Arguments:
-w 1 -s 40 -p black
-b 0.5 -c overlay

Arguments:
-w 1 -s 100 -p black
-b 0.5 -c overlay

Original Image

Arguments:
-w 1 -s 10 -p white
-b 0.5 -c over

Arguments:
-w 1 -s 20 -p white
-b 0.5 -c over

Arguments:
-w 1 -s 30 -p white
-b 0.5 -c over

Arguments:
-w 1 -s 40 -p white
-b 0.5 -c over

Arguments:
-w 1 -s 100 -p white
-b 0.5 -c over

Original Image

Arguments:
-w 1 -s 10 -p white
-b 0.5 -c overlay

Arguments:
-w 1 -s 20 -p white
-b 0.5 -c overlay

Arguments:
-w 1 -s 30 -p white
-b 0.5 -c overlay

Arguments:
-w 1 -s 40 -p white
-b 0.5 -c overlay

Arguments:
-w 1 -s 100 -p white
-b 0.5 -c overlay



Variation In Width

Original Image

Arguments:
-w 1 -s 20 -p black
-b 0.5 -c over

Arguments:
-w 2 -s 20 -p black
-b 0.5 -c over

Arguments:
-w 3 -s 20 -p black
-b 0.5 -c over

Arguments:
-w 4 -s 20 -p black
-b 0.5 -c over

Arguments:
-w 6 -s 20 -p black
-b 0.5 -c over



Variation In Blur

Original Image

Arguments:
-w 1 -s 20 -p black
-b 0 -c over

Arguments:
-w 2 -s 20 -p black
-b 0.5 -c over

Arguments:
-w 3 -s 20 -p black
-b 1 -c over



What the script does is as follows:

  • Clones the input image and colorizes to either full black or full white
  • Clones the input image, converts to grayscale, applies -morphology edgeout
    to add edges and amplifies the edges appropriately
  • Composites the edge image with -compose over or -compose overlay
    as a mask to blend the white or black image with the original

This is equivalent to the following IM commands.

  • convert $infile \ \( -clone 0 -fill $polarity -colorize 100 \) \
    \( -clone 0 -set colorspace RGB -colorspace gray \
    -morphology edgeout diamond:$width -blur 0x$blur -evaluate multiply $strength \) \
    -compose $cmethod -composite $outfile