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.

SKETCHETCH


Creates an etch-like sketch from an image.

Download Script

last modified: December 08, 2023



USAGE: sketchetch [-m mode] [-e etch] [-B brightness] [-S saturation] [-h hue] [-c color] [-C coloramt] [-t type] [infile] [outfile]
USAGE: sketchetch [-help]

-m ... mode ......... mode for processing; choices are: normal, grayscale,
..................... colorized, shaded and composite; default=normal
-e ... etch ......... etch amount; integer>0; default=4
-B ... brightness ... brightness percent change; -100<=integer<=100; default=0
-S ... saturation ... saturation percent change; -100<=integer<=100; default=0
-H ... hue .......... hue angle change in degrees; -360<=integer<360; default=0
-c ... color ........ colorizing color; any valid opaque IM color is allowed;
..................... default=sienna1
-C ... coloramt ..... colorizing amount; 0<=integer<=100; default=50
-t ... type ......... type of composite (compose mode); choices are: hardlight,
..................... overlay, and softlight; default=hardlight

PURPOSE: To create an etch-like sketch from an image.

DESCRIPTION: PIP creates an etch-like sketch from an image. There is an option for modes of normal, grayscale, colorized grayscale, shaded grayscale and three different composite types.

ARGUMENTS:

-m mode ... MODE for processing. The choices are: normal, grayscale, colorized (from grayscale), shaded (from grayscale) and composite. The default=normal.

-e etch ... ETCH amount. Values are integers>0. The default=4.

-B brightness ... BRIGHTNESS percent change of the image. Value are -100<=integer<=100. The default=0.

-S saturation ... SATURATION percent change of the image. Value are -100<=integer<=100. The default=0.

-H hue ... HUE angle change of the image in degrees. Value are -360<=integer<=360. The default=0.

-c color ... COLOR is the colorizing color. Any valid opaque IM color is allowed. The default=sienna1.

-C coloramt ... COLORAMT is the colorizing amount. Values are 0<=integers<=100. The default=50.

-t type ... TYPE of composite (compose mode). The choices are: hardlight, overlay and softlight. The default=hardlight

Reference:
http://www.creativecloseup.com/color-ink-sketch-effect-in-photoshop

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 -- Variation In Normal Mode Etch Amount

Original Image
(source)

 

Arguments:
-m normal -e 3

 

Arguments:
-m normal -e 4

 

Arguments:
-m normal -e 5

 

Arguments:
-m normal -e 6


Example 2 -- Variation In Mode

Original Image
(source)

 

Arguments:
-m normal -e 5

 

Arguments:
-m grayscale -e 5

 

Arguments:
-m colorized -e 5 -c sienna -C 50

 

Arguments:
-m shaded -e 5

 

Arguments:
-m composite -e 5 -t hardlight

 

Arguments:
-m composite -e 5 -t overlay

 

Arguments:
-m composite -e 5 -t soflight


Example 3

Original Image
(source)

 

Arguments:
-m normal -e 4

 

Arguments:
-m normal -e 5


Example 4

Original Image
(source)

 

Arguments:
-m normal -e 4

 

Arguments:
-m normal -e 4 -S -50

 

Arguments:
-m colorized -e 4 -c deepskyblue -C 35

 

Arguments:
-m colorized -e 4 -c deepskyblue -C 50


What the script does is as follows for the normal mode:

  • Reads the input image
  • Clones it and applies several iterations of -sharp 0x1
  • Applies a -compose overlay to composite them together
  • Writes the output

  • convert -quiet -regard-warnings "$infile" -alpha off +repage $tmpA1
  • etching=""
    for ((i=0; i etching="$etching -sharpen 0x1"
    done
  • bri=$((100+$brightness))
  • sat=$((100+$saturation))
  • hue=`convert xc: -format "%[fx:(200/360)*$hue+100]" info:`
  • if [ "$brightness" = "0" -a "$saturation" = "0" -a "$hue" = "0" ]; then
    modulating=""
    else
    modulating="-modulate $bri,$sat,$hue"
    fi
  • convert $tmpA1 \
    \( +clone $etching \) \
    -compose overlay -composite $modulating \
    "$outfile"