2.6.1.6 imgContrast

Menu Information

Image: Adjustments: Contrast

Brief Information

Adjust image contrast

Command Line Usage

1. imgContrast a:=20;
2. imgContrast a:=-20 img:=mat(1) oimg:=mat(2);

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Adjustment a

Input

double

0

Specifies the amount of contrast change. The valid range is [-100, +100].

Input Matrix img

Input

Image

<active>

Specifies the source image to be manipulated. The default input is the active image.

Output Image oimg

Output

Image

<input>

Specify the output image. By default, the output image is the same as the input image.

See the syntax here.

Description

The imgContrast function increases or decreases the contrast of a bitmap image. To increase the contrast, enter a positive value for the amount variable; otherwise, enter a negative amount to decrease the contrast. The absolute amount of the amount variable determines the amount of contrast change.

Examples

  • Code Sample
//Create a new folder in the Project Explorer
pe_mkdir Adjustments path:=aa$;
pe_cd aa$;
//Create a matrix and import the sample image into it
window -t m;
fname$ = System.path.program$ +"samples\Image Processing and Analysis\white camellia.jpg";
impimage;
window -r %h Original;
window -d;	//Duplicate the image
window -r %h Modified;

//Adjustments
imgBalance c2r:=-7 m2g:=5;	//White balance
imgContrast a:=-22;	 //Decrease contrast
imgBrightness a:=10;	//Increase brightness

window -s T;	//Tile the windows horizontally

Algorithm

The computation uses L_ChangeBitmapContrast() function from LEADTOOLS Main API. Please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_ChangeBitmapContrast topic.

References

LEADTOOLS Main API Help file, Version 14

Related X-Functions

imgBrightness