Enhance legibility of photographed or scanned historical records (civil registrations, parish registers, census pages, old manuscripts). Use when the user asks to improve contrast, make an old document more readable, or enhance a genealogical record image. Requires Pillow.
Improve legibility of faded ink on old paper without destroying the image.
Darken the ink, leave the paper alone. Never use generic auto-contrast or gamma < 1 — both blow out the paper tones and make faded handwriting worse.
import shutil
shutil.copy2(src_path, enhanced_path)
Never overwrite the original. Use suffix -enhanced (e.g.
1902-birth-chanco-enhanced.jpg).
from PIL import Image
img = Image.open(src_path)
if img.mode != 'L':
gray = img.convert('L')