function ConvertToBWThreshold(Threshold: Integer = -1): Integer;
Description
Convert a true color image (24 bit) to black & white (1 bit) using a thresholding algorithm.
The image is first converted to gray levels, then all levels less than Threshold are set to black, while the remainder are set to white.
Threshold is an intensity value (0..255).
If Threshold is -1, the threshold value used will be the average level of the original image.
If Threshold is -2, a Maximum Entropy Algorithm is used.
Result is the threshold that was applied (e.g. if threshold was passed as -1, the result will be the average threshold level). If the image cannot be processed (e.g. it is already black & white), the result will be -1
Note: Any selection is ignored. The whole image is converted to the specified palette
// Convert true color image to black & white using the Floyd-Steinberg algorithm ImageEnView1.Proc.ConvertToBW_FloydSteinberg();
// Convert true color image to black & white using a local threshold algorithm (mean) ImageEnView1.Proc.ConvertToBWLocalThreshold( 4, ietMean );
// Convert true color image to black & white using a local threshold algorithm (median) ImageEnView1.Proc.ConvertToBWLocalThreshold( 4, ietMedian );
// Convert true color image to black & white using a local threshold algorithm (min/max mean) ImageEnView1.Proc.ConvertToBWLocalThreshold( 4, ietMeanMinMax );
// Convert true color image to black & white with an ordered dithering method ImageEnView1.Proc.ConvertToBWOrdered();
// Convert true color image to black & white using a thresholding algorithm ImageEnView1.Proc.ConvertToBWThreshold( 128 );
// Convert true color image to black & white using a thresholding algorithm (using the average level) ImageEnView1.Proc.ConvertToBWThreshold( -1 );
// Convert true color image to black & white using a thresholding algorithm (using maximum entropy) ImageEnView1.Proc.ConvertToBWThreshold( -2 );