Threshold Image
Controlled node
Overview
The Threshold Image node converts an image to grayscale and applies a binary threshold based on a specified brightness value. This creates a high-contrast black and white image where pixels brighter than the threshold become white and darker pixels become black. This is particularly useful for preparing images for OCR, removing backgrounds from scanned documents, or creating stylized monochrome images.
Inputs
| Input | Type | Description | Default |
|---|---|---|---|
| Run | Event | Triggers the threshold operation. | - |
| Image | Data | The input image to process. Accepts Jimp image objects from other image processing nodes or the Read Image node. | - |
| Max | Number | The brightness threshold value (0-255). Pixels with brightness above this value become white; those below become black. | 0 |
Outputs
| Output | Type | Description |
|---|---|---|
| Done | Event | Fires when the threshold operation has completed successfully. |
| Output | Data | The processed binary image (Jimp object). |
Runtime Behavior and Defaults
When triggered by the Run event, the node automatically converts the input image to grayscale before applying the threshold. The Max parameter determines the cutoff brightness level:
- Values range from 0 (completely black) to 255 (completely white)
- A value of 128 creates a balanced binary image at medium gray
- The original image is not modified; a new processed image is output
If the Max input is not connected, it defaults to 0, which typically results in a mostly black image depending on the specific brightness distribution of the source.
Example Usage
Connect a Read Image node's output to the Image input of the Threshold Image node. Set the Max value to 128 to remove gray backgrounds from a scanned document. Connect the Done event to trigger an Image OCR node to extract text from the binarized result, or connect the Output to a Write To Library node to save the processed image.
Example workflow chain:
- Read Image → loads a scanned document with gray background
- Threshold Image (Max: 128) → converts to clean black and white
- Image OCR → extracts text from the high-contrast result
- Write To Library → saves the binarized image as a PNG file