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

VIBRANCE2


Applies a non-linear change to the chroma channel of an image.

Download Script

last modified: November 15, 2017



USAGE: vibrance2 [-a amount] infile outfile
USAGE: vibrance2 [-h or -help]

-a ... amount ... vibrance amount; float>=0; default=1; no change

PURPOSE: To apply a non-linear change to the chroma channel of an image.

DESCRIPTION: VIBRANCE applies a non-linear change to the vibrance of an image using a gamma adjustment of the chroma channel in HCL colorspace. image.

ARGUMENTS:

-a amount ... AMOUNT is the vibrance value relative to 1. Values are floats>=0. The default=1 (no change). Larger values increase the vibrance and smaller values decrease the vibrance.

REQUIREMENTS: IM 6.8.6-3 or greater in order to properly use HCL colorspace after a bug was fixed.

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


Original Image
(source)

Arguments:
-a 1.5

Arguments:
-a 1.75

Arguments:
-a 2.0

Reference 2x Saturation:
-define modulate:colorspace HCL -modulate 100,200,100

(note the red colors are much more saturate here than in the vibrance results)



What the script does is as follows:

  • Converts the image to HCL colorspace
  • Clones the Chroma channal and applies a gamma adjustment
  • Removes the old Chroma channel
  • Recombines the H, new C and L channels
  • Converts to sRGB colorspace

This is equivalent to the following IM commands

  • convert "$infile" \
    -colorspace HCL -separate \( -clone 1 -gamma $amount \) \
    -swap 1,-1 +delete -set colorspace HCL -combine -colorspace sRGB \
    "$outfile"