2.6.1.12 imgInvert
Contents
Menu Information
Image: Adjustments: Invert
Brief Information
Invert image color
Command Line Usage
1. imgInvert oimg:=<new>;
2. imgInvert 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 |
|---|---|---|---|---|
| Input Matrix | img |
Input Image |
|
Specifies the source image to be manipulated. The default input is the active image. |
| Output Image | oimg |
Output Image |
|
Specifies the output image. By default, the output image is the same as the input image. See the syntax here. |
Description
The imgInvert function inverts the colors in the specified bitmap, making it like a photographic negative. This function can also be used to invert the color of a 1-bit image, making the black white and the white black.
Examples
In this example, we use the imgInvert function to invert the color of the input image:
- When the input image is active, select Image: Adjustments: Invert. This opens the dialog of the X-Function.
- In the X-Function dialog, change the settings as the screenshot below and click OK to close the dialog.

A new image is created. We can see that the color is inverted.
Algorithm
For gray scale image,
For color Image,
where O(x, y) is the output pixel value, I(x, y) is the input pixel value, and Bits is Bits Per Pixel.
The computation uses L_InvertBitmap() function from LEADTOOLS Main API. Please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_InvertBitmap topic.
References
LEADTOOLS Main API Help file, Version 14





