Fred's ImageMagick Scripts


    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:

    Please read the Pointers For Use on my home page to properly install and customize my scripts.


Applies a Roy Lichtenstein newspaper cartoon effect to an image.

Download Script

last modified: December 15, 2018

USAGE: lichtenstein [-p poster] [-b blur1] [-s sigmoidal] [-d dither]
[-B blur2] [-e edge] [-g gain] [-E erode] [-c colors] [-S sat] infile outfile

USAGE: lichtenstein [-h or -help]

-p ... poster ...... posterize levels; integer>=0; default=7
-b ... blur1 ....... main blurring amount; float>=0; default=3
-s ... sigmoidal ... amount of sigmoidal contrast; float>=0; default=2
-d ... dither ...... ordered dither kind; any valid IM ordered dither;
.................... default=o8x8; suggested alternate is h6x6a
-B ... blur2 ....... minor blurring amount; float>=0; default=1
-e ... edge ........ amount of edge enhancement; integer>=0; default=2
-g ... gain ........ edge gain; float>=0; default=5
-E ... erode ....... erosion of edges to thicken; integer>=0; default=1
-S ... sat ......... saturation amount; integer>=0; default=175;
.................... (100 is no change)

PURPOSE: To apply a Roy Lichtenstein newspaper cartoon effect to an image.

DESCRIPTION: LICHTENSTEIN applies a Roy Lichtenstein newspaper cartoon effect to an image.


-p poster ... POSTER is the number of posterize levels. Values are integers>=0. The default=7.

-b blur1 ... BLUR1 is the main blurring amount. Values are floats>=0. The default=3.

-s sigmoidal ... SIGMOIDAL is the amount of (inverse) sigmoidal contrast. Values are floats>=0. The default=2.

-d dither ... DITHER is the kind of ordered dither to use. Any valid IM ordered dither is allowed. The default=o8x8. A suggested alternate is h6x6a. If dither=none, the dithering will be disabled.

-B blur2 ... BLUR2 is the minor (softening) blurring amount. Values are floats>=0. The default=1.

-e edge ... EDGE is the amount of edge enhancement. Values are integers>=0. The default=2.

-g gain ... GAIN is the amount of edge gain (intensity). Values are floats>=0. The default=5.

-E erode ... ERODE is the amount of erosion of the edges to thicken them. Values are integers>=0; default=1.

-S sat ... SAT is the color saturation amount. Values are integers>=0. The default=175. (100 is no change)


REQUIREMENTS: IM or higher due to the use of colorspace HCL in -modulate.

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.


Original Image


-d o8x8


-d h6x6a


-d none

Original Image


-s 2 (defaults)


-s 4

Original Image



What the script does is as follows:

  • Clones the original image and posterize it and applies the main blur
  • Apply sigmoidal-contrast, modulate to increase saturation and dithers it
  • Clones the original image and extracts edges
  • Desaturates it to convert to grayscale
  • Applies morphological erode and minor blur to smooth it a little
  • Clones the grayscale edge image and negates it
  • Puts the negated edge image into alpha channel of edge image
  • Deletes temps and composites the edge image over the dithered image

This is equivalent to the following IM commands.

  • convert $infile \
    \( -clone 0 -posterize $poster -blur 0x$blur1 \
    +sigmoidal-contrast ${sigmoidal}x50% \
    -define modulate:colorspace=HCL -modulate 100,$sat,100 -ordered-dither $dither \) \
    \( -clone 0 -blur 0x$blur2 -morphology edge diamond:$edge -evaluate multiply $gain \
    -negate -define modulate:colorspace=HCL -modulate 100,0,100 \
    -morphology erode diamond:$erode -blur 0x$blur2 \) \
    \( +clone -negate \) \
    \( -clone 2 -clone 3 -alpha off -compose copy_opacity -composite \) \
    -delete 0,2,3 -compose over -composite \