Schema LawSign in with Google

How to OCR a Photo of a Document Taken on a Phone

By Schema LawPublished Updated

To OCR a photo of a document, take the picture from directly above with the page flat, evenly lit and filling the frame. Upload the JPEG, PNG or a PDF made from the photos to an OCR tool, export text or Word, and compare the result with the photo before you rely on it.

A phone is often the only scanner in the room: at a clerk's counter, in a client's kitchen, in a records office that allows cameras but not copies. A careful photo can convert as well as a flatbed scan. A careless one fails for reasons that take seconds to avoid, and most of this post is about those seconds.

At the clerk's counter the page is often a motion in limine or an ex parte motion, with a case management conference date stamped in the margin. You photograph the caption and that stamp square and close, and you include any pretrial conference note on the back. A tilted shot makes the stamp's digits the first thing to fail.

Can you OCR a photo instead of a scan?

Yes. OCR works on any image of text, and a photo from a current phone holds enough pixels for it. What a photo lacks is the scanner's controlled conditions: a flat page, even light and a fixed distance. You have to supply those yourself when you take the picture.

The pixel count is easy to check. Recognition engines want a certain density of dots across each letter. The documentation for the open-source engine Tesseract, for instance, says it works best on images of at least 300 dpi. A 12-megapixel photo is about 4,000 by 3,000 pixels. Fill that frame with a letter-size page, 11 inches on its long side, and you get roughly 360 pixels per inch. That is above the mark.

The same sum shows the most common mistake. Stand back so the page takes up half the width of the frame, with desk on every side, and the density halves to about 180 pixels per inch. The photo looks fine on a phone screen and reads badly, because every letter is drawn with half the dots.

So the answer has a condition attached. A photo converts well when:

  • the page fills most of the frame,
  • the camera was parallel to the paper,
  • the light was even, with no shadow or glare across the text,
  • the text is in focus edge to edge, and
  • the phone did not shrink the image when you sent it.

Miss one of these and you can usually still get text out of a photo of a document, with more proofreading. Miss three and you should take the picture again if the paper is still in reach.

Taking a photo that OCR can read

A photo OCR can read is flat, square, sharp and evenly lit. Put the page on a plain dark surface, hold the phone directly above its center, fill the frame, turn the flash off, tap to focus on the text and hold still. Then zoom in on the smallest print before you move on.

In order:

  1. Flatten the page. Remove staples and paper clips if you are allowed to. Smooth folds. Weigh down curling corners with something outside the text area.
  2. Use a contrasting background. White paper on a dark desk gives the software, and any scanning app, a clear page edge.
  3. Light from the side, not from behind you. Overhead light behind your shoulder puts the shadow of your hands and phone on the page. Stand so a window or lamp is to one side, or lift the page toward the light.
  4. Turn the flash off. Flash on paper produces a white hot spot in the middle and dark corners. On glossy paper it wipes out the text under the glare.
  5. Hold the phone parallel to the page. All four edges of the paper should look parallel to the edges of the screen. Many camera apps show a level indicator when pointed straight down.
  6. Fill the frame, with a thin margin. Keep all four corners in the picture. Do not use digital zoom, which enlarges pixels without adding any.
  7. Focus and steady. Tap the text on screen, brace your elbows, breathe out and press. In dim rooms the phone uses a slower shutter, and small movements blur fine print.
  8. Check before you leave the page. Zoom to the smallest text on the page: the footnote, the stamp, the form number. If you can read it comfortably on the phone, the software has a fair chance.

Scanning apps and the document modes built into phone cameras automate several of these steps. They find the page edges, flatten the perspective and raise the contrast. That usually helps. Two cautions apply. Some apps convert the image to stark black and white, which can erase pencil, light stamps and faint signatures. And automatic edge detection sometimes crops off a margin note or a page number. Compare the app's result with the paper while you still have it.

Keep the original photo even if you send an app's cleaned version for conversion. The untouched picture is the closest thing you have to the paper.

From phone photo to text, step by step

Getting from phone photo to text takes six steps: move the full-size image off the phone, put it in a format the tool accepts, combine the pages if there are several, upload, export the text, and check it against the picture. The first two steps are where phone photos pick up most of their avoidable damage.

  1. Transfer at full size. Text messages and some chat apps compress pictures heavily. Email often offers a choice of sizes, so pick "actual size". A cable, a cloud drive or a file-sharing feature between your own devices keeps every pixel.
  2. Make sure the format is accepted. Many phones save photos in HEIC format by default. Schema Law accepts PDF, PNG and JPEG and identifies a file by its contents, so renaming a .heic file to .jpg will not work. Export or convert it to JPEG properly.
  3. Decide between one image and one PDF. A single page can go up as a JPEG or PNG. For several pages, combine the photos into one PDF in page order so the document stays together. Turning a phone photo of a document into a PDF is a built-in function on most phones through the print or share menu.
  4. Upload. In Schema Law you sign in with Google and drop the file on the upload area. The limit is 20 MB per file.
  5. Read the parsed pages, then export. Plain text is the quickest way to pull a passage out. Word suits editing. A searchable PDF keeps the photo as the page with text you can search behind it.
  6. Compare with the photo. Read names, numbers and dates against the image. The post on why OCR output is full of errors gives a full method.

A note on size. A full-resolution photo commonly runs to several megabytes, so a PDF of fifteen pages can pass 20 MB. If it does, split it into two files in page order. Do not shrink the images to make them fit. Shrinking takes away the pixel density you worked to get.

To try this without paying, the free plan reads one document a day of up to three pages, and exports every format the paid plans do, Word, Excel and searchable PDF among them. Three photographed pages in one PDF make a fair test. The pricing page covers the limits for longer documents.

What do shadows, glare and perspective do to recognition?

Shadows, glare and perspective each damage recognition in a different way. A shadow makes part of the page too dark to separate ink from paper. Glare makes part of it too bright. Perspective changes the size and angle of the text from one side of the page to the other.

ProblemWhat it looks like in the photoWhat it does to the textFix at capture
ShadowA gray band or the outline of your hand across the pageWords in the dark area dropped or garbledMove the light to the side; step out of it
GlareA white patch, often on glossy paper or under a plastic sleeveText under the patch missing entirelyFlash off; tilt the page slightly; remove the sleeve
PerspectiveThe page is a trapezoid, wider at the near edgeFar lines small and misread; lines not parallelHold the phone directly above the center
Motion blurLetters smeared in one directionWrong characters throughoutBrace, add light, retake
FocusSharp center, soft edges, or sharp desk and soft pageErrors in the soft zoneTap the text to focus; move back slightly
CurlLines of text bend near a fold or spineLine ends lost, lines mergedFlatten; photograph one page at a time

Shadows cause trouble because many engines first reduce the picture to black and white before reading it. Tesseract's documentation notes that this step can give a poor result "particularly if the page background is of uneven darkness". A threshold that suits the bright half of the page turns the shaded half solid black.

Perspective is the one fault a scanner never has. When the phone is tilted, the far edge of the page is further from the lens, so the text there is smaller and its lines converge. A page shot at a steep angle can have comfortable density at the bottom and half that at the top. Apps can stretch the trapezoid back into a rectangle, but stretching cannot restore pixels the far edge never had.

A tilted photo also has ordinary skew, where the whole page sits at an angle in the frame. That is dealt with the same way as on a scanner, and the post on how to OCR a crooked scan explains the effect and the checks.

The background can cause errors too. Wood grain, a keyboard, the edge of another document or your thumb in the corner may be read as stray characters at the start or end of the output. If the first line of your text is nonsense, look at what was beside the page.

Photographing multi-page documents at a courthouse or records office

Photographing multi-page documents in the field is mostly a problem of order and completeness. You get one visit. Work out a routine before you start, capture every page in sequence including blanks, and check the count and the legibility before you hand the file back.

Ask first. Courts, clerks' offices and archives set their own rules on phones and cameras, and the rules differ from one building to the next. Some ban photography, some charge a fee, some allow it only for certain records. Check the local rules or ask at the counter before you take out a phone.

A routine that holds up:

  1. Photograph an identifying shot first. The file jacket, the docket number, the box label or the request slip. It marks where each document begins in your camera roll.
  2. Go page by page in order. Do not skip to the interesting pages and come back. Include blank backs if the pages are double-sided, so the count matches.
  3. One page per photo. Two pages in one shot halves the pixels on each.
  4. Keep the setup fixed. Same spot on the table, same distance, same light. Slide each new page into place instead of moving the phone.
  5. Capture stamps, seals and certification pages. The filed stamp, the clerk's certificate and the back cover often matter as much as the text.
  6. Count before you leave. Compare the number of photos with the number of pages. Flip through at full zoom for blur. Retake anything doubtful while the file is on the table.

Back at the office, rename or sort the photos so page order does not depend on the camera's file names, combine each document into its own PDF, and note where and when the pictures were taken. If a filing or a rule calls for a certified copy, a photo may not be accepted in its place, so check what your court requires. Order the certified copy and use your photos to work from in the meantime.

Remember what is on the phone. Photos of court files and client papers may sync to a personal cloud account or sit in a shared family album. Move them to the firm's storage and delete them from the phone when you are done. For the questions to ask about any service you send them to, see the post on whether it is safe to upload client documents to an OCR tool. Schema Law's own commitments are listed in the security section of the homepage.

JPEG, PNG and PDF as upload formats

JPEG, PNG and PDF all work as upload formats for a photographed document. JPEG is what phones produce and is fine at high quality. PNG keeps every pixel and suits screenshots. PDF is the right container when several photos make up one document.

FormatBest forWatch for
JPEGA single photographed page straight from the cameraRepeated saving or heavy compression leaves smudges around letters
PNGScreenshots and images that have already been editedLarge files for photographs, with no gain in readable detail
PDFA multi-page document made from several photos"Reduce file size" options that lower the image quality inside

Some practical points:

  • Each image is one page. A JPEG or PNG holds a single picture. Ten photos of a ten-page affidavit are ten separate uploads unless you combine them, and on a plan with a daily document limit that matters. A PDF keeps them as one document with page numbers.
  • Do not convert for the sake of it. Saving a JPEG as a PNG does not undo the JPEG compression. It only makes the file bigger. Convert when the tool will not take the format you have, as with HEIC.
  • Avoid re-saving JPEGs. Every save at reduced quality compresses again. Crop or rotate once, from the original, and save at the highest quality setting.
  • Screenshots of documents are low density. A screenshot of a page shown on a phone has only as many pixels as the screen. If you can get the file behind the screenshot, use that.
  • Watch the 20 MB ceiling. Split a long PDF into parts instead of compressing its images.
  • Orientation. Phones record which way up the photo was taken as a tag in the file. Most software honors it. If a page arrives sideways, rotate it in an image editor and save, so the pixels themselves are turned.

Whichever format you upload, the export is where the text ends up, and you can export the same document more than once in different formats. The list of export formats shows what each one is for.

All posts in Difficult scans