GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / IsBitonal Method / IsBitonal(Int32) Method
GdPicture image identifier.
Example





In This Topic
IsBitonal(Int32) Method
In This Topic
Determines whether a GdPicture image or the area defined by SetROI() method is composed of black and white pixels only. This method uses a linear formula to determine the color intent. To obtain more accurate result the ColorDetection() method should be used instead.
Syntax
'Declaration
 
Public Overloads Function IsBitonal( _
   ByVal ImageID As Integer _
) As Boolean
public bool IsBitonal( 
   int ImageID
)
public function IsBitonal( 
    ImageID: Integer
): Boolean; 
public function IsBitonal( 
   ImageID : int
) : boolean;
public: bool IsBitonal( 
   int ImageID
) 
public:
bool IsBitonal( 
   int ImageID
) 

Parameters

ImageID
GdPicture image identifier.

Return Value

True if it is a bitonal image, else False.
Remarks

Use the GetStat() method to check if this method has completed successfully.

This method uses a linear formula to determine the color intent. To obtain more accurate result the ColorDetection() method should be used instead.

Example
Saving an image to tiff ccitt IV or jpeg depending whether it is bitonal or not.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.bmp");
 
    // Save the image to tiff ccitt iv in case it is bitonal otherwise save to jpeg.
    if (gdpictureImaging.IsBitonal(imageID))
    {
        gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4);
    }
    else
    {
        gdpictureImaging.SaveAsJPEG(imageID, "image.jpg", 75);
    }
 
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also