Turning a phone photo of a signed page into clean black and white
A phone photo of a printed page is never really black and white. The paper is a light grey, warmer in one corner, the ink is a dark grey, and the camera adds noise. Printed, faxed or pasted into a form, that grey picture looks dirty. A threshold fixes it by making a hard choice for every pixel: black or white, nothing in between.
The choice is made on brightness. Each pixel's brightness is 21% of its red, plus 72% of its green, plus 7% of its blue, on a scale from 0 to 255. Then one number, the cut-off, decides. With a cut-off of 128, a pixel of brightness 127 becomes black and a pixel of 128 becomes white. A blue ballpoint signature with a brightness of about 70 turns black, and paper at about 225 turns white.
Picking the cut-off by hand is the hard part, so Auto picks it with Otsu's method, from 1979 and still the standard first choice. It builds a histogram of how many pixels have each brightness. On a page there are two humps: a small one for the ink and a large one for the paper. Otsu tries every possible cut-off and keeps the one where the two groups are most clearly apart. For a page with ink around 60 and paper around 235, the cut-off lands between them, so the ink stays black and the paper goes white.
The two other presets are for when Auto gets it slightly wrong. Keep faint lines uses a high cut-off of 190, so pencil, light ink and thin strokes stay black; the cost is that grey shadows on the paper may turn black too. Clean background uses a low cut-off of 110, which turns grey paper and shadows white; the cost is that very light strokes may disappear. Fine-tune lets you set any value from 1 to 255, and its slider starts at the level Auto found.
The limits matter for documents. One cut-off is used for the whole image, so uneven light, such as a shadow across half the page, cannot be fully fixed; retake the photo in even light instead. Coloured stamps and highlighter turn black or white depending on their brightness. A JPEG photo is saved as JPEG, and JPEG compression adds faint grey specks along every stroke. For pure black and white pixels, convert the photo to PNG with Image Convert first, then threshold the PNG. The file is still an ordinary image, not a 1-bit fax file, and the largest image it takes is 24 megapixels.