Image to Text (OCR)

Copy the words out of a photographed document, a screenshot or a scan. Recognition runs on your device, and you can edit the result straight away.

Pick the language in the image. Two languages at once is a little slower.

Your images are processed on this device and never uploaded to a server.

How to use it

  1. Choose one or more images, drop them on the box above, or paste a screenshot with Ctrl+V.
  2. Check Text language. Add a Second language if the image mixes two, for example English and Spanish.
  3. Wait for the reading to finish. The percentage under each file name shows its progress.
  4. Correct the text in the box if needed, then press Copy or Download .txt. For several pages, use Copy all.

How this tool reads text

The tool uses Tesseract, an open-source OCR engine, running in your browser through Tesseract.js. The language models come from the tessdata_fast set: LSTM neural networks that read the image one line at a time. For Latin-script languages these models were trained on about 400,000 lines of text in about 4,500 fonts.

Each image is prepared before it is read. The camera's orientation tag (EXIF) is applied. Images under 1 megapixel are enlarged, up to 3×, towards 2 megapixels, because tiny letters are hard to separate. For example, an 800 × 600 screenshot is enlarged 2.04× to 1633 × 1225 pixels. In our tests, 9-pixel text in a JPEG screenshot had 46% of its words right without enlarging and 94% after enlarging 2×. Photos over 12 megapixels are reduced to 12 megapixels: on our test computer a 53-megapixel image was read in 2.2 seconds instead of 7.1, with the same result. If automatic page layout finds no text, or its confidence is below 60%, the image is read again as a single block of text. That second pass rescues pages photographed a few degrees off level.

What accuracy depends on

  • Letter size. The Tesseract documentation recommends at least 300 DPI. At 300 DPI, 10 pt text has an x-height (the height of a lowercase x) of about 20 pixels, and below 10 pixels accurate results are unlikely.
  • Contrast. Dark text on a light background works best. Shadows, folds and patterned backgrounds lower accuracy.
  • Straight lines. A skewed page makes the lines hard to separate.
  • Printed text. Handwriting is recognised poorly.

Tips for photographing documents

  1. Lay the paper on a flat surface in even light. Turn the flash off to avoid glare.
  2. Hold the phone parallel to the paper, so the page edges look straight and the page nearly fills the screen.
  3. Tap the text on screen to focus and wait until it is sharp.
  4. One page per photo. A 4032 × 3024 photo filled by a Letter or A4 page works out at about 340 to 360 DPI.

Limits

The result is plain text. Tables, columns and formatting are not kept, and text from neighbouring columns can end up on one line. PDF input is not supported yet. Because everything runs on your device, large photos take time on phones, and very large images can fail when memory runs out. Always proofread OCR output before you use it, especially numbers such as account or invoice numbers.

Questions

Are my images uploaded to a server?
No. The image is read by your browser on your device. The only downloads from swift.id are the OCR engine and the language data, once, and your browser caches them. That makes the tool safe for photos of ID cards, payslips or letters.
Why are there so many mistakes?
The usual causes are letters that are too small or blurry, uneven light and a page photographed at an angle. Crop the image to the text, take the photo again closer and straight on, then read it again. A confidence below 60% means the result needs a careful check.
Can it read handwriting?
Only a little. Tesseract, the OCR engine used here, is trained on printed text, and its own documentation says handwriting won't work very well. Very neat handwriting is sometimes partly read, but don't rely on it.
Can it read PDF files?
Not yet. For a scanned PDF, take a screenshot of each page and add the images here. If you can select the text in your PDF reader, copy it from there instead: that is always more accurate than OCR.
Why is it slow on my phone?
Recognition runs on your phone's processor, not on a server. On our test computer a 12-megapixel photo of a 130-word page was read in 1.5 seconds; a phone, especially an older one, can take several times longer. The first use also downloads the language data (English is 1.9 MB). Cropping the photo to the text speeds things up.
Which languages can it read?
English, Indonesian, Spanish, Portuguese, French and German, and you can combine two of them. Non-Latin scripts such as Arabic, Cyrillic or Chinese are not available yet.