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. |
Generates a piece-wise linear mapping grayscale look up table |
last modified: December 15, 2018
USAGE: plmlut [-s xscale,yscale] [-t thickness] [-g] "x1,y1 x2,y2 ..." lutfile
"x1,y1 x2,y2 ..." ........ break point values of piece-wise linear transformation PURPOSE: To generate a piece-wise linear mapping grayscale look up table. DESCRIPTION: PLMLUT takes the supplied break point pairs and generates a one dimensional piece-wise linear grayscale look up table image that can be used to change grayscale values in the channel(s) of an image. From 1 to 40 point pairs can be supplied either as arguments or in a text file with one pair per line supplied. The x value is the position in the look up table which is associated with the grayscale value of the desired channel(s) of the input image to be modified and the y value is the associated grayscale value for the corresponding channel(s) in the resulting output image. ARGUMENTS: "x1,y1 x2,y2" ... List of x,y break-points for the piece-wise linear transformation. The x,y values are non-negative break-point pairs for the piece-wise linear transformation. There is a minimum one point pair that must be supplied. The x and y values are associated with the input and output grayscale values of the look up table, where x,y values can range from 0 to xscale,yscale. xscale determines the length of the 1D lookup table (length=xscale + 1); that is, the range of x (input) values and yscale determines the range of y (output) values. Both xscale and yscale must be positive integers and their defaults are 100. If the first pair is not 0,0 or the last pair is not xscale,yscale then those points will be added automatically to the list of point pairs. IMPORTANT: the list of break-point pairs must be specified just prior to lutfile. -f point_file ... point-file is a text file containing the list of break points, one x,y pair per line. -s xscale,yscale ... xscale,yscale is the range of values for the x,y breakpoint pairs which go from 0 to xscale,yscale; positive integers. The default is 100,100. Larger values for xscale and yscale can be used for more accuracy. For example with xscale=yscale=100, x and y values are specified between 0 and 100 and the length of the output image is 101 pixels. For xscale=yscale=255, x and y values are specified # between 0 and 255 and the length of the output image is 256. Equal values for xscale and yscale are not required. -t thickness ... thickness is the height of the lutfile. The default is 10. -g ... enables the creation of a graph of the piece-wise linear transformation, which is then displayed automatically. There is a default setting below that can be changed to enable this to be save to a file named lutfile_graph.gif. The graph will be scaled to size 100x100. IMPORTANT: To end the script, close/quit the graph image. 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. |
Various Piece-wise Linear LUTs |
||
arguments: |
arguments: |
arguments: |
What the script does is as follows:
This is equivalent to the following IM commands for the
|
See the script PLM for examples where the LUTs are applied to images.