Image Threshold Tool
Convert an image to two tones with a manual threshold or automatic Otsu selection, with adaptive thresholding for uneven lighting and a histogram showing where the split falls.
Last reviewed by the Radiatus Cloud team
Need this done properly for your business?
Radiatus delivers secure cloud, DevOps & compliance engineering.
Thresholding is the first step in reading an image
Optical character recognition, barcode reading, document scanning and shape analysis all start by reducing an image to two values, because deciding whether a pixel is ink or paper is far easier than working with 256 shades. The whole result depends on where the split is placed: too low and text breaks up, too high and the background floods in. Choosing that point well is most of the difficulty.
Otsu chooses the threshold from the histogram
Rather than guessing, Otsu's method tries every possible threshold and picks the one that best separates the pixels into two groups, by maximising the variance between the groups. It requires no parameters and works well whenever the histogram has two clear peaks, which is the case for most scanned documents. It fails when lighting is uneven across the image, because then no single value is right everywhere.
Adaptive thresholding handles uneven lighting
A photograph of a page taken by hand is brighter on one side than the other, so a single threshold either loses text in the shadow or fills the highlight with noise. Adaptive thresholding computes a local threshold from the neighbourhood of each pixel instead, which follows the lighting gradient. It costs more time and is the only approach that works on photographed documents rather than flatbed scans.
Related tools
- EXIF Viewer — Extract hidden EXIF data (Camera, GPS, Settings) from images.
- Favicon Generator — Generate favicons and app icons at every required size from one source image, with the exact HTML to reference them.
- Placeholder Image Generator — Generate placeholder images at any size with custom colours and label text. Produced in your browser as downloadable files, no external hotlinking.
- Image Resizer — Resize images in your browser with aspect ratio control and format conversion. Files are processed locally and never uploaded.
Frequently Asked Questions
What is Otsu's method?
An automatic threshold selection that tries every possible value and picks the one maximising the variance between the two resulting groups. It needs no parameters and works well when the histogram has two clear peaks.
When does a single threshold fail?
When lighting is uneven across the image, which is normal for a photograph of a document. No single value is right everywhere: it loses text in the shadowed area or floods the bright one with noise.
What does adaptive thresholding do differently?
It computes a threshold from the neighbourhood around each pixel rather than using one value for the whole image, so it follows the lighting gradient. It is slower and is the only approach that works on hand-held photographs of documents.
Why threshold at all?
Because deciding whether a pixel is ink or paper is far easier than working with 256 shades. Character recognition, barcode reading and shape analysis all start here, and the quality of everything after depends on this step.
What block size should adaptive use?
Large enough to contain both text and background around any pixel, so noticeably bigger than the stroke width of the text. Too small and the interior of a thick stroke has no background nearby, so it comes out inverted.
Privacy & Security
Everything runs in your browser; nothing is uploaded.
How to Use
Upload an image and set a threshold, or let the tool choose one automatically.
Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.
Related Tools
EXIF Viewer
ImageExtract hidden EXIF data (Camera, GPS, Settings) from images.
Favicon Generator
ImageGenerate favicons and app icons at every required size from one source image, with the exact HTML to reference them.
Placeholder Image Generator
ImageGenerate placeholder images at any size with custom colours and label text. Produced in your browser as downloadable files, no external hotlinking.