How image to text (OCR) works
OCR stands for optical character recognition: software that looks at the shapes in a picture and works out which letters they are. This tool uses Tesseract, an open-source OCR engine first developed at HP and later improved by Google, compiled to run inside your browser.
Here is what happens when you click Extract text:
- Preparing the image. The photo is turned upright, and small images are enlarged. Tesseract reads best when capital letters are roughly 20 to 40 pixels tall, so a 600-pixel-wide screenshot is enlarged about three times. With Enhance image on, colours are turned to grey and the contrast is stretched, so the darkest 1% of pixels becomes black and the brightest 1% white.
- Finding text lines. Tesseract separates text from background, then finds blocks, lines and words.
- Reading each line. A neural network (an LSTM, which reads a line as a sequence, a bit like you do) turns each line into characters, using the language data you picked.
- Scoring. Every word gets a confidence score. The percentage shown under the result is the average for the page.
The OCR engine and the language file (between 0.4 and 3.7 MB) are downloaded once from jsDelivr and stored by your browser. Your image is processed on your device and never uploaded.
A worked example
A phone photo of a printed receipt, 3,024 × 4,032 pixels, is already large enough, so it is not enlarged. With English selected and Enhance image on, a typical result is about 90 to 95% confidence: totals and dates usually come out right, while faded thermal print and tiny logos may be misread. A screenshot of a web page, 1,280 × 720 pixels, is enlarged to 2,000 × 1,125 before reading and usually scores 95% or more, because screen text is perfectly sharp.
Tips for better accuracy
- Pick the right language. Tesseract only recognises the characters of the languages you select. For an Urdu letter that contains English names or numbers, keep Also read English words ticked.
- Get the text upright. Use the rotate buttons until the text reads normally. Sideways text gives nonsense.
- Shoot straight on. Hold the phone parallel to the page, fill the frame with the text and avoid shadows from your hand or phone.
- Light it evenly. Daylight from a window is ideal. Avoid flash, which creates a bright glare spot.
- Crop first. If the image contains photos, logos or several columns, crop it to just the text you need.
- Screenshots beat photos. If the text is on a screen, take a screenshot instead of photographing the display.
What works well and what does not
| Source | Typical result |
|---|---|
| Screenshot of a web page or app | Excellent |
| Scanned typed document (300 DPI) | Excellent |
| Phone photo of a printed page | Good, if sharp and evenly lit |
| Receipt or faded thermal paper | Fair; check numbers carefully |
| Printed Arabic or Naskh Urdu | Good on clean, large text |
| Nastaliq Urdu (newspapers, books) | Fair; needs a sharp, high-resolution image |
| Handwriting | Poor; Tesseract is trained on print |
| Text on curved or creased surfaces | Poor to fair |
Languages
You can choose from 39 languages, including English, Urdu, Arabic, Hindi, Bengali, Punjabi, Persian, Spanish, French, German, Portuguese, Russian, Turkish, Chinese (Simplified and Traditional), Japanese and Korean. Right-to-left languages (Arabic, Urdu, Persian and Hebrew) are shown right to left in the result box. Each language is a separate download, so adding English to another language adds about 2.8 MB the first time.
After extracting
The result box is editable, so fix any misread words before you copy or download it. Use the word counter to check the length of the text. If you are working with a PDF that already contains selectable text, PDF to text is faster and copies the text exactly, with no recognition errors.