ImageGear for .NET
ImageIsGray Method
See Also  Example Send Feedback
ImageGear21.Core Assembly > ImageGear.Processing Namespace > ImGearRasterProcessing Class : ImageIsGray Method




page
Image to test.

Glossary Item Box

Returns true if either the image has GrayScale color space or its palette is gray or inverted gray.

Syntax

 
Visual Basic
C#
Managed Extensions for C++
C++/CLI
 
 

Parameters

page
Image to test.

Return Value

Boolean value.

Remarks

This method returns true if either of the two conditions are met:
  • Image has grayscale color space.
  • Image has indexed color space, and palette is either linear gray, or inverted gray.

Example

C#Copy Code
// Make sure the image is gray.
if (!ImGearRasterProcessing.ImageIsGray(igRasterPage))
    return;
// Create a LUT to convert image from 8bit to 4bit while also inverting.
ImGearMultichannelLUT igMultichannelLUT = new ImGearMultichannelLUT(
    igRasterPage.DIB.ChannelCount, 8, 4);
for (int i = 0; i < 255; ++i )
{
    igMultichannelLUT[0][i] = 15 - (i / 16);
}
// Transform the image with the LUT.
ImGearRasterProcessing.TransformWithLUT(igRasterPage,igMultichannelLUT);
Visual BasicCopy Code
' Make sure the image is gray.
If Not ImGearRasterProcessing.ImageIsGray(igRasterPage) Then
    Return
End If
' Create a LUT to convert image from 8bit to 4bit while also inverting.
Dim igMultichannelLUT As New ImGearMultichannelLUT(igRasterPage.DIB.ChannelCount, 8, 4)
For i As Integer = 0 To 254
    igMultichannelLUT(0)(i) = 15 - (i / 16)
Next
' Transform the image with the LUT.
ImGearRasterProcessing.TransformWithLUT(igRasterPage, igMultichannelLUT)

See Also

©2013. Accusoft Corporation. All Rights Reserved.