Image threshold

You finish a phone photo of a printed contract, and the gray paper refuses to separate from the ink. A single luminance cutoff forces every pixel to either white or black, which is ugly on portraits yet perfect when you want a stencil, a fax-style mask, or a quick OCR-friendly plate. The workspace below keeps pixels on your device, so an NDA screenshot or a hospital form never transits our servers.

Load an imageTap here, or drop a file. Decoding runs locally.
128

Adaptive compares each pixel with a local mean (15×15 neighborhood, minus a constant). The slider is ignored while adaptive is active.

Source
After cutoff

Scanner desk realism

Office scanners often deliver 300 dpi grayscale TIFFs that already look acceptable on screen. Thresholding still helps when you need a one-bit fax mask or when you paste the graphic into a slide template that demands pure black strokes. Start from the native scan, not a JPEG re-save, because each lossy cycle adds mosquito noise around letters.

When forms include checkboxes, a slightly lower global cutoff keeps pencil graphite visible without filling entire squares. When forms use blue ink, the green channel sometimes separates better than luminance; this page does not expose per-channel thresholds, so we recommend fixing separation upstream or accepting a single-channel compromise.

Batch workflows belong on the desktop. This interface targets one honest preview at a time: you see source and binary together (or flip between them on a narrow phone), you hear the slider snap through values, you download when the halos look tolerable. For redaction chains where you must hide faces after binarizing text, chain photo censor only after you trust the mask edges.

Labels for the three modes (read once, then forget the jargon)

Binary
Each pixel becomes white when luminance meets or beats your cutoff, otherwise black. This is the textbook global threshold: one number rules the whole frame.
Inverted
Same math as binary, but the polarity flips. Bright regions fall to black, shadows to white. Useful when you need a negative mask without opening color inversion.
Adaptive
The cutoff travels with a sliding window so a gradient background does not drown half the text. Expect slower runs on huge rasters because every pixel asks for a neighborhood average.

Pixels after the cutoff

We convert RGB to luminance with the usual ITU-style weights (roughly 0.299 red, 0.587 green, 0.114 blue), then compare against either your global value or the local mean. Alpha copies forward unchanged, so transparent PNGs stay transparent where the source allowed.

Nothing uploads. The FileReader API pulls bytes into memory, canvas writes pixels, and toDataURL builds the PNG when you hit save. If you need to prove tonal spread before you commit to a cutoff, open color distribution on a duplicate export and read the histogram story there.

Before and after, described instead of staged

Receipt on a wooden table: Global threshold at 150 blows out the varnish grain while keeping the thermal print readable. Adaptive pulls the same text up when the wood darkens toward the frame.

Signature on blue ink: Inverted mode yields a white glyph on black, which pastes cleanly into slide decks without fiddling blend modes.

Low-resolution logo PNG: Threshold exaggerates anti-alias halos. We recommend smoothing edges in a vector tool after export, or stepping back to smart optimizer if file size drove the harsh compression.

Privacy stanceSession-only memory. Closing the tab drops decoded bitmaps unless your browser caches the page itself. We do not store filenames, dimensions, or derived PNGs.

What this page refuses to promise

Thresholding is not edge detection. If you need gradients turned into lines, edge detection operators answer a different question. Thresholding is also not dithering: you will not retrieve midtones once they collapse to black or white.

Very large images stress mobile GPUs; adaptive mode multiplies work. For a 24 megapixel dump, consider downsampling in a desktop editor first, then fine-tune here.

Bench noteAdaptive implementation: mean of a 15×15 neighborhood minus constant 10, compared against the center pixel luminance. Constants match the legacy in-page prototype we replaced; tweak upstream in your fork if you need scholarly Sauvola or Niblack parameters.
Quick movesStart near 128 on balanced photos, nudge in steps of five, watch halos around hair before you lock export.Scanning for OCR? Binary mode plus a slightly high cutoff often preserves stroke width better than aggressive adaptive on uniform paper.When both panels feel small on a phone, flip between Source and Binary chips instead of pinching two canvases at once.

Threshold questions we still get

Short answers tied to this page, not generic photo help.

Why does adaptive ignore my slider?

Adaptive computes a different cutoff per pixel from local brightness. The global slider would fight those per-pixel decisions, so the UI disables while adaptive runs.

Which export format do I receive?

PNG, because binary art needs lossless channels. JPEG would reintroduce gray mush around edges you just removed.

Does thresholding help every OCR engine?

Many engines preprocess internally. Some prefer grayscale. Run an A/B test on your pipeline; if OCR worsens, send the grayscale sibling from black and white conversion instead.

How does CMYK input behave?

The browser decodes to RGBA first. Embedded CMYK profiles map before threshold math, which is fine for quick tests but not a substitute for print-calibrated workflows.

Why is my night photo all black or all white?

The luminance histogram probably sits in a narrow band. Lift shadows or tame highlights elsewhere, then return. Extreme single-tone frames have no meaningful cutoff.