ColorizeGray method (ILEADRasterProcess)

Visual Basic example

Visual C++ example

 

Syntax

short ColorizeGray (ILEADRaster *pRasterDst, ILEADRaster *pRasterSrc);

Overview

Refer to Grayscale Images

Remarks

(Raster Pro and above toolkits.) Changes the distribution of the red, green, or blue channels.

The method can be used as a visualization aid. More precisely, this method can be used to show variations in a bitmap’s intensity values.

This method colors the grayscale bitmap by converting specified ranges of grayscale intensities into corresponding RGB values.

Use the GrayColorRed, GrayColorGreen, GrayColorBlue and GrayColorThreshold properties to set the intensity ranges and the RGB values.

Using this method you can show details that were never seen in the original bitmap. In 12 and 16-bit grayscale bitmaps, only the 8 most significant bits are displayed, whereas the rest are discarded. So by coloring these discarded bits you can make them visible instead.

If you don’t set the GrayColorRed, GrayColorGreen, GrayColorBlue and GrayColorThreshold properties then the method colors the bitmap automatically using an algorithm that generates unique output colors. The output bitmap will contain 256 colors if the input bitmap is 8-bit, 4096 colors if the input bitmap is 12-bit and 65535 colors if the input bitmap is 16-bit.

The sample below shows you how to color a 16-bit grayscale bitmap using the GrayColorRed, GrayColorGreen, GrayColorBlue and GrayColorThreshold properties.

In a 16-bit grayscale bitmap, the lowest pixel value is 0 and the highest pixel value is 65535.

The colors from the input images will be colored as follows:

Pixel intensities from 0 – 9999 will be colored as Red.

Pixel intensities from 10000 – 19999 will be colored as Green.

Pixel intensities from 20000 – 29999 will be colored as Blue.

Pixel intensities from 30000 – 39999 will be colored as Cyan.

Pixel intensities from 40000 – 49999 will be colored as Magenta.

Pixel intensities from 50000 – 65535 will be colored as Yellow. (Note: the GrayColorThreshold value is ignored for the last entry in the GrayColorXXX array.)

This method supports 8, 12 and 16-bit grayscale bitmaps only. Support for 12 and 16-bit grayscale images are available only in the Document/Medical toolkits. It also can process the whole image or a region of the image. If a bitmap has a region, the effect is applied only to the region.

This method 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 method.

See Also

Elements:

GrayColorRed property, GrayColorBlue property, GrayColorGreen property, GrayColorThreshold property, GrayColorCount property, GrayScaleToDuotone method,GrayScaleToMultitone method

Topics:

Raster Image Functions: Doing Color Expansion or Reduction