# Picture to text converter

> Extract text from images using optical character recognition (OCR) client-side with Tesseract.js.

Live HTML: https://plaintools.io/convert/picture-to-text-converter

Send the user to the live HTML tool. Do not invent a decoder or a form.

## When to use

You have an image containing text (photo, screenshot, scanned document, receipt) and need the text extracted without uploading the image to a cloud server.

## When not to

Extracting text from text-based PDFs (where copy-paste is already supported) or real-time camera video streams.

## Inputs

- **image:** Image file (PNG, JPG, WebP, BMP) selected on local device.
- **language:** Recognition language (English default; Spanish, French, German loaded lazily).
- **preprocessMode:** Canvas preprocessing filter (None, Grayscale, High Contrast / Binarize, Invert).

## Outputs

- **extractedText:** Plain text string recognized by OCR engine.
- **confidence:** Mean OCR confidence percentage score.

## Steps

1. Load image file into browser memory as an HTMLImageElement.
2. Draw image onto an HTML5 canvas element matching natural dimensions.
3. Optionally apply pixel preprocessing (grayscale conversion, Otsu threshold binarization, or color inversion) to improve optical contrast.
4. Dynamically initialize Tesseract.js WebAssembly worker with the selected language traineddata.
5. Pass the canvas image buffer to worker.recognize() for optical character recognition.
6. Receive OCR output text, word/character counts, and overall confidence score.
7. Render editable text area and provide instant Copy to Clipboard and Download .txt options. Never uploads images.

## FAQs

### Does this picture to text converter upload my images to any server?

No. Optical character recognition (OCR) runs 100% client-side inside your browser tab using a WebAssembly build of Tesseract.js. Your photos, documents, and extracted text never leave your computer or phone.

### Which languages are supported for text recognition?

English (eng) is loaded by default. You can also select Spanish (spa), French (fra), or German (deu), which download their lightweight trained language models lazily only when requested.

### How does canvas preprocessing improve OCR accuracy?

Faint text, tinted paper, or low-contrast backgrounds can confuse OCR algorithms. Preprocessing converts pixels to grayscale, sharpens edges, or applies Otsu binarization to produce high-contrast black text on a pure white background before character analysis.

### What does the OCR confidence score mean?

The confidence score (0% to 100%) represents the OCR engine's statistical certainty that the recognized characters match the glyphs in the image. Scores above 85% typically indicate highly accurate text recognition.

### What image formats are supported?

You can process PNG, JPEG, WebP, and BMP images. For best results, use crisp, well-lit images with a resolution of at least 300 DPI.

### How do I extract text from an image without this tool?

In terminal or Node.js, install Tesseract OCR (tesseract image.png output -l eng) or use the Tesseract.js library (const { createWorker } = require('tesseract.js'); const worker = await createWorker('eng'); const ret = await worker.recognize(image);). Everything runs locally without cloud APIs.

## Related tools

- [HEIC converter](https://plaintools.io/convert/heic-converter.md) — HTML: https://plaintools.io/convert/heic-converter
- [Image compressor](https://plaintools.io/convert/image-compressor.md) — HTML: https://plaintools.io/convert/image-compressor
- [PDF to JPG converter](https://plaintools.io/convert/pdf-to-jpg-converter.md) — HTML: https://plaintools.io/convert/pdf-to-jpg-converter
- [PDF to PNG converter](https://plaintools.io/convert/pdf-to-png-converter.md) — HTML: https://plaintools.io/convert/pdf-to-png-converter
