Skip to content

Photos of curved pages, made flat

Page Dewarp uses a physical model of how paper bends to straighten photos of books, newspapers, and documents. Use this app to run it without installing anything.

# Upload a photo, get a flat page back
curl -s https://page-dewarp-api.louismmx.workers.dev/api/dewarp \
  -H "Authorization: Bearer pdw_your_key" \
  -F "file=@book-page.jpg" \
  --output dewarped.png

# That's it. One image in, one image out.

Most document scanning apps just correct perspective — they assume the page is flat. Real pages aren't flat. They curve near the spine, ripple under glass, and warp when you hold them open with your thumb.

page-dewarp fits a cubic spline to the actual curvature of the page, then maps the image back to a flat plane. The result is noticeably sharper, with less distortion at the margins.

📐

Physically modelled

Fits a cubic Hermite spline to the shape of the page, modelling how the paper surface physically bends.

🔧

Every knob exposed

All page-dewarp parameters are available via a single JSON header. Focal length, margins, threshold, optimiser settings — tune anything. New library params work automatically.

📦

Structured metadata

Every response includes the fitted rotation, translation, cubic coefficients, and page corners as JSON. Useful for QA, batch analysis, or downstream processing.

JAX-accelerated

The backend runs page-dewarp with JAX autodiff, making the optimisation step ~11× faster than the SciPy fallback. Typical processing: 2–4 seconds per image.

💳

Pay per image

No subscriptions. Buy credit packs from £2 and use them whenever. If processing fails, you're not charged. See pricing →

🔓

Open source core

The library behind this API is MIT-licensed and on GitHub. This service is for people who want dewarping without managing Python, NumPy, SciPy, OpenCV, and JAX.

Give it a try

Upload an image in the browser or call the API directly.

Processing high volumes? The open-source library runs locally with native batch mode — up to 33× faster for multi-image workloads. The API is for lighter use and integration.