Backend
I built a free image preprocessor to get better OCR results (PrepOCR)
AranaDeDoros Dev.to (EN Zone)
1 views
The problem
OCR is only as good as the image you feed it. A scanned form that's slightly tilted, low-contrast, or has a noisy background can tank recognition accuracy — even with a good OCR engine behind it. Most of the time the fix isn't a better OCR model, it's a cleaner input image.
I wanted something small I could throw a batch of images at before sending them to an OCR pipeline, so I built PrepOCR — a free image preprocessing service focused specifically on the transformations that actually move the needle for OCR.
What it does
Right now it supports:
Tilt correction : rotate the image by a given angle
Contrast — boost contrast so text separates more cleanly from the background
Binarization: convert to pure black and white, with a configurable threshold (0–255), which is often the single biggest accuracy win for scanned documents
You upload one or more images, pick your settings, and get back a zip of the optimized versions.
You can try it here
How it's built
The backend is Scala + http4s, AssetFlow. Uploads come in as multipart requests, get validated (size, dimensions, actual image-type sniffing via magic bytes, not just trusting the extension), processed, and zipped back up.
One thing worth sharing: since each image's transformation is CPU-bound and independent of the others, I moved the per-file processing from a sequential traverse to parTraverseN, so a batch of images gets processed concurrently instead of one at a time. On my machine (14 cores), converting/optimizing 4 PNGs dropped from ~7s to ~2s. On the free-tier host it's deployed on, that gain mostly evaporates — CPU is throttled hard enough that "parallel" mostly just means "finely interleaved" rather than truly concurrent. Cheap and free lesson: Runtime.getRuntime.availableProcessors() will happily lie to you about how much CPU you actually have in a shared container.
Where it's at
This is genuinely an MVP, I built it because I needed it, not because I've validated demand. No idea yet if anyone else will find it useful, but if you're doing anything with scanned documents, forms, or OCR pipelines and want to try offloading the preprocessing step, I'd love feedback.
Feature requests, bug reports, and "this already exists and does it better" comments are all welcome.
Read original: https://dev.to/aranadedoros/i-built-a-free-image-preprocessor-to-get-better-ocr-results-prepocr-52do
← Previous
Node.js Account Shutdown: Token Revocation and Eventual Deletion in 3 Steps
Next →
Gemini Often Won't Search the Web — and Won't Tell You It Didn't
Related
Node.js Account Shutdown: Token Revocation and Eventual Deletion in 3 Steps
Backend
0
Dev.to (EN Zone)
[Boost]
Backend
4
DEV Community
Creating a Robot Sensor Data Recording and Replay System
Backend
3
DEV Community
Why is it so hard to code something that you think should be easy?
Backend
1
Reddit r/webdev
Comments0
No comments yet — be the first