Performs a direct secondary image conversion step, converting a color or grayscale image to a black-and-white (bi-tonal) one.
Declaration:
Copy Code | |
---|---|
AT_ERRCOUNT ACCUAPI IG_REC_image_reduce_to_bitonal( HIG_REC_IMAGE hImageIn, enumIGRecImgConversion Conversion, AT_INT Brightness, AT_INT Threshold, enumIGRecImgResEnhancement resolenh, HIG_REC_IMAGE * phImageOut ); |
Arguments:
hImageIn | Handle of the image to be converted (either grayscale or color). |
Conversion | Image conversion mode to be applied during the conversion of the hImageIn image. Possible enumIGRecImgConversion values are IG_REC_IMG_CONVERSION_AUTO, IG_REC_IMG_CONVERSION_SET, IG_REC_IMG_CONVERSION_GLOBAL. |
Brightness | Brightness of the image (range is 0 to 100, where 0 means the darkest and 100 means the lightest resulting image). This parameter has effect only if the Conversion parameter is set to IG_REC_IMG_CONVERSION_AUTO. |
Threshold | Threshold value to be set. Its range should be between 0 and 255. This parameter has effect only if the Conversion parameter is set to IG_REC_IMG_CONVERSION_SET. |
resolenh | Resolution enhancement setting to be applied during the conversion (enumIGRecImgResEnhancement). |
phImageOut | Handle of the bi-tonal image to be created. |
Return Value:
Returns the number of ImageGear errors that occurred during this function call.Supported Raster Image Formats:
Indexed RGB - 8 bpp;
Grayscale - 8 bpp;
RGB - 24 bpp.
Remarks:
If the phImageOut image is no longer needed, it should be removed from the image management subsystem by invoking the IG_REC_image_delete function.
Example:
Copy Code | |
---|---|
AT_ERRCOUNT ErrCount = 0; HIGEAR higImage = 0; HIG_REC_IMAGE higRecImage = 0; HIG_REC_IMAGE higRecImageOut = 0; ErrCount += IG_load_file("Image.tif", &higImage); ErrCount += IG_REC_image_import(higImage, &higRecImage); ErrCount += IG_REC_image_reduce_to_bitonal(higRecImage, IG_REC_IMG_CONVERSION_AUTO, 40, 100, IG_REC_IMG_RE_AUTO, &higRecImageOut); //... ErrCount += IG_REC_image_delete(higRecImage); ErrCount += IG_REC_image_delete(higRecImageOut); ErrCount += IG_image_delete(higImage); |