#include "ltwrappr.h"

virtual L_INT LBitmap::ColorLevel (pLvlClr, uFlags)

pLVLCLR pLvlClr;

pointer to a LVLCLR structure

L_UINT uFlags;

a flag that indicates the channel being color leveled

Applies color leveling to an image. It changes the image shadows, midtones and highlights.

Parameter Description
pLvlClr Pointer to a LVLCLR structure that contains several LVLCLRINF structures, which in turn contain information on the shadows, midtones and highlights for the Red, Green, Blue and Master channels.
uFlags Flag that indicates the channel being leveled. Possible values are:
  Value Meaning
  LEVEL_RED [0x0001] Red channel
  LEVEL_GREEN [0x0010] Green channel
  LEVEL_BLUE [0x0100] Blue channel
  LEVEL_MASTER [0x1000] All channels</b>*



The function was successful.

< 1

An error occurred. Refer to Return Codes.


This function is also useful for pre-processing images for the purpose of improving barcode recognition results.

Before calling the LBitmap::ColorLevel function, initialize the size and all remaining fields of the LVLCLRINF structures within the LVLCLR structure. These fields tell LBitmap::ColorLevel what constitutes shadows, midtones, and highlights and how to remap the shadows, midtones and highlights.

Control the amount of image balance and leveling by controlling the values of the members of the LVLCLRINF structure contained in the pLvlClr parameter.

If only LEVEL_MASTER is set in uFlags then the rest of the channels will still be affected.

If the image is a grayscale image, then you must set LEVEL_MASTER in uFlags, otherwise the function will not have any effect.

If nMinOutput > nMaxOutput then the bitmaps shadows and highlights will be inverted.

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

If the image has a region, the effect will be applied on the region only.

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

Required DLLs and Libraries


For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.


Win32, x64.

See Also


LBitmap::AdjustTint. LBitmap::ColorHalfTone, LBitmap::Sharpen, LBitmap::Posterize, LBitmap::Mosaic, LBitmap::Emboss, LBitmap::MedianFilter, LBitmap::AddNoise, LBitmap::IntensityDetect, LBitmap::SpatialFilter, LBitmap::BinaryFilter, LBitmap::MaxFilter, LBitmap::MinFilter, LBitmap::Oilify, LBitmap::Solarize, LBitmap::AutoColorLevel, LBitmap::SelectiveColor, LBitmap::AutoBinarize, LBitmap::DynamicBinary, LBitmap::AutoBinary, Class Members


Raster Image Functions: Modifying Intensity Values


Changing Brightness and Contrast


Correcting Colors


Color Halftones and Halftone Images


Raster Image Functions: Working with Color Halftones, Halftones, and Grayscale Images


Raster Image Functions: Changing Brightness and Contrast


Raster Image Functions: Correcting Colors


This example applies image leveling to an image.

L_INT LBitmap__ColorLevelExample(LAnimationWindow * LAniWnd) 
   LVLCLR lvlClr; 
   lvlClr.uStructSize = sizeof(LVLCLR); 
   lvlClr.uStructSize = sizeof(LVLCLR); 
   /* Specify Image levels */ = 20; = 200; = 0; = 255; = DEFAULT_GAMMA; 
   // Master will cause the image to be Inversed 
   lvlClr.master.nMinInput = 0; 
   lvlClr.master.nMaxInput = 255; 
   lvlClr.master.nMinOutput = 255; 
   lvlClr.master.nMaxOutput = 0; 
   lvlClr.master.uGamma = DEFAULT_GAMMA; 
   /* Level the Blue and Master channels */ 
   return LAniWnd->ColorLevel (&lvlClr, LEVEL_BLUE | LEVEL_MASTER); 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help