Click or drag to resize
Ranorex

ImagingProcessingThreshold Method

Converts the input image to a black/white image (i.e. an image that contains only two different colors) using the specified threshold value.

Namespace:  Ranorex
Assembly:  Ranorex.Core (in Ranorex.Core.dll) Version: 12.7.4-git.38314c06
Syntax
public static Bitmap Threshold(
	Bitmap input,
	byte threshold
)

Parameters

input
Type: System.DrawingBitmap
An image.
threshold
Type: SystemByte
The threshold value that decides whether an output pixel is colored black or white. If the input value is smaller than the threshold, the output pixel is colored black, otherwise white.

Return Value

Type: Bitmap
A grayscale image that contains only black and white pixels.
Exceptions
ExceptionCondition
ArgumentNullExceptionIf input is null.
ArgumentExceptionIf the input image is not a grayscale image and cannot be converted to Format24bppRgb pixel format (i.e. if it is no color image in a 32 bit format).
Remarks
If the image is not a grayscale image, it will be converted using the ConvertRgbToGrayscaleImage(Bitmap) method.
See Also