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.

VIVIDIZE


Enhances the colors in an image.

Download Script

last modified: May 31, 2021



USAGE: vividize [-a amount] [-c choice] infile outfile
USAGE: vividize [-h|-help]

-a amount .... amount of vividization; 0<=integer<=100; default=100 (full vividization)
-c choice .... choice for vividizing; color (c), intensity (i) or both (b); default=both

PURPOSE: To enhance the colors in an image.

DESCRIPTION: VIVIDIZE enhances the colors in an image, i.e. makes the colors more vivid. Processing is done in LAB colorspace.

ARGUMENTS:

-a amount ... AMOUNT of vividization. Values are 0<=integer<=100. The default=100 (full vividization).

-c choice ... CHOICE for vividizing. Options are: color (c), intensity (i) or both (b). The default=both.

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

Arguments:
-a 100
(default)



Example 2

Original

Arguments:
-a 100
(default)



Example 3

Original

Arguments:
-a 100
(default)

Arguments:
-a 50

Arguments:
-a 0



What the script does is as follows:

  • Reads the input image
  • Converts to LAB colorspace
  • Computes the minimum and maximum in each of the A and B channels
  • Then finds the mimimum or maximum closest to 0 or 100%
  • Then stretches the A and B channels from that offset to 0 and 100%
  • Also stretch the L channel to its full dynamic range
  • Saves the result

This is equivalent to the following IM commands

  • loval=`convert "$infile" -colorspace LAB \
    -format "%[fx:100*min(min(min(minima.g,minima.b),1-maxima.g),1-maxima.b)]" info:`
  • hival=`convert xc: -format "%[fx:100-$loval]" info:`
  • amt1=`convert xc: -format "%[fx:$amount/100]" info:`
  • amt2=`convert xc: -format "%[fx:1-$amt1]" info:`
  • convert "$infile" \
    \( +clone -colorspace LAB \
    -channel R -auto-level +channel \
    -channel GB -level $loval,$hival% +channel \) \
    +colorspace \
    -set option:compose:args "0, $amt1, $amt2, 0" \
    -compose mathematics -composite \
    "$outfile"