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 As Integer _
) As Boolean
public bool IsBitonal(
int
)
public function IsBitonal(
: Integer
): Boolean;
public function IsBitonal(
: int
) : boolean;
public: bool IsBitonal(
int
)
public:
bool IsBitonal(
int
)
Parameters
- ImageID
- GdPicture image identifier.
Return Value
True if it is a bitonal image, else False.
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);
}
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