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.

VIBRANCE3


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

Download Script

last modified: July 28, 2018



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

-a ... amount ... vibrance amount; float; positive values increase vibrance and
................. negative values decrease vibrance; default=0; no change

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

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

ARGUMENTS:

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

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


Example 1 -- Increasing Vibrance

Original Image
(source)

Arguments:
-a 1

Arguments:
-a 2

Arguments:
-a 3

Arguments:
-a 4



Example 2 -- Decreasing Vibrance

Original Image
(source)

Arguments:
-a -1

Arguments:
-a -2

Arguments:
-a -3

Arguments:
-a -4



What the script does is as follows:

  • Converts the image to HCL colorspace
  • Adjusts the sigmoidal-contrast on the green (Chroma) channel only
  • Converts back to sRGB colorspace

This is equivalent to the following IM commands

  • sign=`convert xc: -format "%[fx:sign($amount)]" info:`
  • if [ $sign -eq -1 ]; then
    sgn="+"
    elif [ $sign -eq 1 ]; then
    sgn="-"
    fi
  • amount=`convert xc: -format "%[fx:abs($amount)]" info:`
  • convert -quiet "$infile" -colorspace HCL \
    -channel g ${sgn}sigmoidal-contrast $amount,0% +channel \
    -colorspace sRGB +repage "$outfile"