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

COLORTONING


Color tones an image in highlights and/or shadows and/or overall

Download Script

last modified: April 25, 2015



USAGE: colortoning [-ch highcolor] [-cl lowcolor] [-ca allcolor] [-bh -blendhigh] [-bl blendlow] [-ba blenall] [-o order] [-i images] infile outfile

USAGE: colortoning [-help|h]

-ch ... highcolor ... desired highrange or highlight color; default=no
..................... highlight toning
-cl ... lowcolor ... desired lowrange or shadow color; default=no
..................... shadow toning
-ca ... allcolor .... desired overall color; default=no overall toning
-bh ... blendhigh ... blending amount for hightlights; 0≤integer≤100;
..................... default=100 (all hightoned and no input)
-bl ... blendlow .... blending amount for shadows; 0≤integer≤100;
..................... default=100 (all shadowtoned and no input)
-ba ... blendall .... blending amount for overall color; 0≤integer≤100;
..................... default=100 (all shadowtoned and no input)
-o .... order ....... order of tonal processing steps; comma separate
..................... string involving any non-duplicated combination
..................... of H,L,A; one, two, or three letters may be
..................... specified; default="HLA" to process highlights
..................... first, then shadows, then all
-i .... images ...... choice of view or save intermediate images
..................... resulting from each toning step; default=neither

PURPOSE: To color tone an image in highlights and/or shadows and/or overall.

DESCRIPTION: COLORTONING will color tone an image in highlights and/or shadows and/or overall. The amount of blending with the original image in each tonal range can be specified. The default is not to blend with the original image. Processing occurs sequentially from highlights to shadows to overall toning.

ARGUMENTS:

-ch highcolor ... HIGHCOLOR is the highrange or highlight color desired for the toning. Any valid opaque IM color is allowed. The default is no highlight color toning.

-cl lowcolor ... LOWCOLOR is the lowrange or shadow color desired for the toning. Any valid opaque IM color is allowed. The default is no shadow color toning.

-ca allcolor ... ALLCOLOR is the overall color desired for the toning. Any valid opaque IM color is allowed. The default is no overall color toning.

-bh blendhigh ... BLENDHIGH is the percent blending of the highlight toned image with the original (or previous toned version). Values are integers in the range of 0 to 100. The default=100 means all toned image and no blending.

-bl blendlow ... BLENDLOW is the percent blending of the shadow toned image with the original (or previous toned version). Values are integers in the range of 0 to 100. The default=100 means all toned image and no blending.

-ba blendall ... BLENDAll is the percent blending of the overall toned image with the original (or previous toned version). Values are integers in the range of 0 to 100. The default=100 means all toned image and no blending.

-o order ... ORDER is the order of the tonal processing steps. Values are a comma separate string involving any non-duplicated combination of H,L and A. One, two or three letters may be specified. The default="H,L,A" to process highlights first, then shadows, then all.

-i images ... IMAGES permits the viewing or saving of the intermediate images generated during the processing. The choices are: view (v) or save (s). The default is neither. If images=save, then files will be named for the input image with _colortoning_#.png where #=1 and/or 2 and/or 3.

REFERENCE: http://phlearn.com/color-toning-with-reference-episode110

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
(see http://phlearn.com/color-toning-with-reference-episode110)

Original Image

Arguments:
-cl "#2a1236" -ca "#bc978e" -ch "#f2f4e9" \
-bl 65 -ba 20 -o "l,a,h" -i save

Low (Shadow) Toning Step

Color Swatch
#2a1236

All (Overall) Toning Step

Color Swatch
#bc978e

High (Highlight) Toning Step

Color Swatch
#f2f4e9

Comparison Original vs Final



What the script does is as follows:

  • Does a colored blend with input or previous toning step for
    each desired tonal range

This is equivalent to the following IM commands for Highlights:

  • convert -quiet -regard-warnings "$infile" $dir/tmpI.mpc
  • convert $dir/tmpI.mpc $dir/tmpP.mpc
  • blendhigh2=$((100-blendhigh))
  • convert $dir/tmpP.mpc \
    \( -clone 0 -fill "$highcolor" -colorize 100% \) \
    \( -clone 0 -colorspace gray \) \
    -compose blend -define compose:args=$blendhigh,$blendhigh2 -composite \
    $dir/tmpP.mpc
  • convert $dir/tmpP.mpc $outfile