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.

DRAGANEFFECT


Applies a Dragan-like effect to an image to enhance wrinkles creating a 'gritty' effect.

Download Script

last modified: December 15, 2018



USAGE: draganeffect [-b brightness] [-c contrast] [-d darkness ] [-s saturation] infile outfile
USAGE: draganeffect [-h or -help]

-b ... brightness ... brightness factor; float>=0; default=1 no change
-c ... contrast .... contrast; float; nominally -10 to 10; default=0
-d ... darkness ..... shadow darkness; float>=1; default=1
-s ... saturation ... saturation; integer>=0; 100 (no change); default=150

PURPOSE: To apply a Dragan-like effect to an image.

DESCRIPTION: DRAGANEFFECT applies a Dragan-like effect to an image to enhance wrinkles creating a "gritty" effect.

ARGUMENTS:

-b brightness ... BRIGHTNESS is a brightness factor. Values are floats>=0. The default=1 or no change. Increase brightness is larger than 1. Decrease brightness is less than 1.

-c contrast ... CONTRAST is a sigmoidal contrast. Values are floats nominally in the range of -10 to 10. Positive values increase contrast and negative values decrease contrast. The default=0 (no change).

-d darkness ... DARKNESS is the shadow darkening factor. Values are floats>=1. The default=1 or no change. Darker shadows is larger than 1.

-s saturation ... SATURATION. Values are integer>=0. A value of 100 is no change. The default=150.

REFERENCES:
http://andrzejdragan.com/
http://www.dmimaging.net/photography-trends-dragan-effect/
http://photoshopfrenzy.com/?p=94

REQUIREMENTS: IM 6.6.1.9 due to the use of -morphology DoG

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

Original
(source image)

Arguments:
-b 1 -c 0 -d 1 -s 150
(default)

Arguments:
-b 1.5 -c -5 -d 1 -s 175

Arguments:
-b 1.5 -c -5 -d 2 -s 175



Example 2

Original
(source image)

Arguments:
-b 1 -c 0 -d 1 -s 150
(default)

Arguments:
-b 1 -c -7.5 -d 1 -s 200

Arguments:
-b 1 -c -7.5 -d 1.25 -s 200



Example 3

Original
(source image)

Arguments:
-b 1 -c -5 -d 1 -s 150

Arguments:
-b 1 -c -10 -d 1 -s 200



Example 4

Original
(source image)

Arguments:
-b 1 -c -5 -d 1.75 -s 175



What the script does is as follows:

  • Read image, enhance brightness, apply sigmoidal-contrast and saturation
  • Clone, desaturate, darken and compose multiply with input
  • Clone previous result and apply high pass filter using DoG
  • Clone both use overlay composite to apply high pass filter to enhanced input
  • Clone enhanced input and desaturate, delete temps
  • Use hardlight composite to apply desaturated image to enhanced image and save output

This is equivalent to the following IM commands

  • darkness=`convert xc: -format "%[fx:3/$darkness]" info:`
  • abscontrast=`convert xc: -format "%[fx:abs($contrast)]" info:`
  • convert $tmpA1 -evaluate multiply $brightness +sigmoidal-contrast ${abscontrast}x50% -modulate 100,$saturation,100 \
    \( -clone 0 -modulate 100,0,100 -evaluate multiply $darkness \) -compose multiply -composite \
    \( -clone 0 -bias 50% -define convolve:scale=1 -morphology Convolve DoG:0,0,$radius \) \
    \( -clone 0 -clone 1 -compose overlay -composite \) \
    \( -clone 0 -modulate 100,0,100 \) -delete 0,1 \
    -compose hardlight -composite $outfile