Parameters
- ImageID
- GdPicture image identifier.
- Threshold
- Threshold between 0 (max confidence) and 765 (min confidence). A value near or higher than 50 is highly suggested.
Return Value
True if it is a bitonal image, else False.
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.
This method requires the Image Documents component to run.
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, 0)) { gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4); } else { gdpictureImaging.SaveAsJPEG(imageID, "image.jpg", 75); } gdpictureImaging.ReleaseGdPictureImage(imageID); }
using (GdPictureImaging gdpictureImaging = new GdPictureImaging()) { int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.bmp"); if ((gdpictureImaging.GetBitDepth(imageID) == 1) && gdpictureImaging.IsBitonal(imageID, 0)) { gdpictureImaging.RemoveStapleMark(imageID); gdpictureImaging.SaveAsTIFF(imageID, "image.tif", TiffCompression.TiffCompressionCCITT4); } // Release used resources. gdpictureImaging.ReleaseGdPictureImage(imageID); }