How to extract text from an image, and get it right
Optical character recognition, usually called OCR, reads the letters in a picture and gives you back text you can copy, edit and search. It is useful for receipts, printed forms, book pages and screenshots of documents that you cannot retype easily. OCR is not magic, though. Results depend heavily on the photo, and it struggles with handwriting. This guide explains how to prepare an image, how to use the image to text tool on Valtrinity and how to check what comes back.
What OCR can and cannot do
OCR looks for shapes that match letters and numbers, then groups them into words and lines. It works very well when the letters are clear, evenly sized, dark on a light background and set in a common printed font. It works less well when text is curved, skewed, faded or overlapped by a pattern.
It is weakest with handwriting, because every person forms letters differently and the shapes often run together. If you need to read handwritten notes, a person usually does better, or you can scan the notes at high quality and read them yourself with the text output as a starting point.
- Works best: clear printed text, high contrast, horizontal lines.
- Struggles with: handwriting, faded print, curved or angled text.
- Always check the output against the original.
Prepare the image before you upload
Most OCR problems are caused by the photo, not the software. Hold the phone directly above the page so the paper is flat and the lines run straight across the frame. Use good, even light and avoid shadows falling across the text. Fill the frame with the text you need, rather than a large amount of desk around it.
If you are scanning a document, aim for a sharp, flat image with a plain background. Crop out anything that is not text, such as coffee cups, fingers and table edges, because these can be read as stray characters.
- Shoot straight down, not at an angle.
- Use even light and avoid shadows.
- Crop tightly to the text.
Worked example: a supermarket receipt
A receipt is a good test case because it combines small type, numbers and tight line spacing. Lay the receipt flat on a table, photograph it from directly above and crop to the printed items. Upload the image to the image to text tool and wait for the text to appear.
Look at the result line by line. You may find that the letter O has become the number 0, that a lowercase l has become the number 1, or that a decimal point has been dropped from a price. Correct these by comparing against the receipt. The totals are the most important lines, so check those first.
- Compare totals and prices against the paper receipt first.
- Watch for O and 0, l and 1, and missing decimal points.
- Keep the image until you are sure the text is correct.
Get the best results from printed documents
Printed documents with clear type are where OCR shines. Forms, letters and book pages usually produce clean text. Columns of text can sometimes be read in the wrong order, so scan one column at a time if the page has two or more.
Tables are harder. The software may read all the cells but lose track of which row they belong to. For a table, check every row, and consider typing the important numbers by hand if the table is short.
- Read one column at a time.
- Expect tables to need the most checking.
- Use a high resolution photo or scan for small print.
Check and clean the output
Treat the OCR result as a draft. Read it through once with the original beside you. Fix the errors you find, then search the text for any number or name that matters, such as an account number or a date, and confirm it matches the source.
If you plan to use the text in a document, paste it into your editor and remove line breaks that the scan introduced. Lines broken in the middle of a sentence are one of the most common leftovers from OCR.
- Read the output once against the original.
- Confirm every number, name and date.
- Remove stray line breaks before you reuse the text.
When to type it yourself instead
OCR saves time on long printed text, but it is not always faster. For a short handwritten note, typing it yourself is usually quicker and more accurate than correcting a poor result. Similarly, if a document is faded or heavily stamped, a fresh copy from the sender may be the best route.
- Short handwritten notes: type them yourself.
- Very faded or stamped pages: ask for a clean copy.
- Long clean print: OCR is usually worth it.
Tools mentioned in this guide
Image to Text Converter
Convert an image to text: read the English words in a photo or screenshot and copy them.
ImagesImage Resizer
Resize a picture to exact pixels or a percentage, with social media presets.
ImagesImage Compressor
Shrink and resize PNG, JPEG and WebP images.
Frequently asked questions
Why are some letters wrong in the text?
OCR matches shapes, so similar letters such as O and 0, l and 1, or S and 5 can be confused. Blurry photos and small type make this more likely. Retake the photo closer and flatter, then compare the result with the original.
Can it read handwriting?
It can read very neat handwriting in some cases, but results are usually poor for ordinary handwriting. If the text matters, type it yourself or use the photo as a reference.
Does the image need to be a particular size?
A sharp image with clear text is more important than a specific size. If the text is very small in the frame, crop closer to the text so the letters fill more of the picture.
Can I OCR a PDF page?
You can convert a PDF page to an image first and then run OCR on that image. Check the output carefully, because the conversion step can make small text harder to read.