Remove a date stamp from a scanned photo: crop first, then a mask edit

Remove an orange date stamp from a scanned family photo: crop it for free in Pillow, or mask it and edit with openai/gpt-image-2.5 from $0.0094 an image.

5 min readSume
All posts

To remove a date stamp from a scanned photo, try the free option first: if the stamp sits in a corner on a margin, crop it off in Pillow. If it sits over the picture, mask the stamp and send one edit to openai/gpt-image-2.5 with mask_url, which Sume bills at $0.009375 on low and $0.0835 on high for a 1024x1024 edit with one input image. Do this only for photos you own or have the right to alter.

Date stamps are small, high-contrast, usually orange or white digits near a corner, which makes them a good fit for a masked edit. The part to get right is the mask and the check afterwards.

Option 1: crop it away

Many scanned prints have the stamp in the bottom right with a few millimetres of picture around it. Cropping 5 to 6 percent from the bottom removes it with no model at all, and the remaining pixels are untouched. Crop first, look at the framing, and only go to an edit if the loss of composition is unacceptable.

from PIL import Image

im = Image.open("scan.jpg")
w, h = im.size
im.crop((0, 0, w, int(h * 0.94))).save("scan_cropped.jpg", quality=95)
print("cropped", w, h, "->", w, int(h * 0.94))

Option 2: mask the stamp and edit

Make a mask the same size as the scan that covers the digits plus a small margin, upload it where Sume can fetch it over public HTTPS, and send the scan as the only input reference. The Sume docs describe mask_url as available on ChatGPT Image 2.5 edits and do not publish the polarity, so test it with one low edit before you run the batch.

In the prompt, say what should fill the area: continue the grass texture, the wall, the sky. A vague prompt invites the model to invent a feature. Keep aspect_ratio on auto so the output matches the scan frame. Scans are often larger than 1024 pixels, and the model may return a different pixel size, so check the output dimensions before you replace an archive file.

What the edit costs

Fixture amounts are for one 1024x1024 image with one input reference. A larger scan changes input tokens, so expect the real figure to be somewhat higher.

Sume billed amount per openai/gpt-image-2.5 edit and the cost of an album of 250 scans (read 2026-10-07)
QualityPer edit250 scans
low$0.009375$2.34
medium$0.021$5.25
high$0.0835$20.88

Mask-building tips for stamps

Stamps are usually a fixed font in a fixed place, so one mask often works for a whole roll of scans from the same lab or camera. Measure the box once, add a margin of about the height of a digit, and generate the mask in code for every scan size. A mask that is too tight leaves orange fringe pixels around each digit, and those are what the eye finds first.

Scans from the same roll can differ in size, rotation and crop, because flatbed scanners and lab scans rarely align the same way twice, so do not reuse a mask blindly. Open the first three scans, confirm the stamp position, and keep the coordinates as ratios of width and height rather than pixels. Then run the whole roll at low and review thumbnails in a contact sheet before spending on medium or high for the ones that need it.

Check the neighbourhood

Diff the result against the scan. The stamp area should change and the rest should not. Old prints carry grain, dust and colour casts that a model may smooth away outside the mask; if the whole image looks cleaner, you have changed more than the stamp. For an archive, keep the original scan and store the edited file next to it, with the model and date in the filename.

If the stamp covers a face or fine detail, do not edit it. A hallucinated face on a family photo is worse than a visible date, and so is a smoothed-over background that no longer matches the memory. When in doubt, keep the date.

Sources

Related posts

More in Use cases

All Use cases posts

Written by Sume