https://txtfetch.com/docs/images/
Does the text in a picture come back?
Most of it does. It does not always land where you expect, and some of it is lost. Here is what each format returns.
The short answer
Most of it comes back. Not where you expect, and not all of it.
txtfetch reads a PDF page with OCR when the page has 10 typed characters or fewer. A page with more is not read. A scan with a typed footer is lost. A picture on a typed page is lost.
txtfetch reads every picture in a Word, PowerPoint or Excel file. The text lands at the end of the document, after a line such as image1.png. The alt text is lost.
HTML and email keep the alt text. The picture text follows it.
The flag metadata.ocr is false in all of these cases. Do not use it to find out if OCR ran.
The engine is tika-server-standard 3.3.1.
Source: terraform/lambda-layers/build/versions.env (versions.env: TIKA_VERSION), accessed 2026-10-18.
What comes back, case by case
We sent each file to the production API. Every picture holds the words PICTURE WORDS ALPHA and a second line. Every scan holds the words SCANNED PAGE BRAVO. Every row shows its source. The raw responses are in the repo.
| Input | What comes back | Where it lands | Alt text | Source |
|---|---|---|---|---|
| A PDF with a typed cover page and a scanned second page | Both pages. The scanned page is read by OCR and its text follows the cover. | in place | Not applicable | Production API probe: POST /v1/extract accessed 2026-10-18 |
| A scanned PDF page with 10 typed characters | The typed characters and the scan text. The typed characters can also come back a second time, with OCR errors. | in place | Not applicable | Production API probe: POST /v1/extract accessed 2026-10-18 |
| A scanned PDF page with 11 typed characters | Only the typed characters. The scan is lost and nothing warns you. | not returned | Not applicable | Production API probe: POST /v1/extract accessed 2026-10-18 |
| A typed PDF page with a picture of text on it | Only the typed line. The text in the picture is lost. | not returned | Not applicable | Production API probe: POST /v1/extract accessed 2026-10-18 |
| A Word file with a picture between two paragraphs | The picture is read. Its text comes after the last paragraph, under a line with the picture file name. | at the end | Lost. The picture shows as an empty [image: ] marker. | Production API probe: POST /v1/extract accessed 2026-10-18 |
| The same Word file as Markdown | The file name becomes a heading. The picture text follows as one paragraph. | at the end | Lost | Production API probe: POST /v1/extract accessed 2026-10-18 |
| A PowerPoint slide with a title and a picture | The title first. The picture text comes after it, under the file name. | at the end | Lost | Production API probe: POST /v1/extract accessed 2026-10-18 |
| An Excel sheet with a cell and a picture | The cell first. The picture text comes after the sheet, under the file name. | at the end | Lost | Production API probe: POST /v1/extract accessed 2026-10-18 |
| An HTML page with an inline picture and alt text | The alt text in an [image: ] marker. The picture text follows it at once. | in place | Kept | Production API probe: POST /v1/extract accessed 2026-10-18 |
| An email with an inline picture and alt text | The alt text in an [image: ] marker. The picture text follows it. | in place | Kept | Production API probe: POST /v1/extract accessed 2026-10-18 |
| A PNG file sent on its own | The picture text. This is the only case where metadata.ocr says true. | in place | Not applicable | Production API probe: POST /v1/extract accessed 2026-10-18 |
Real output
Each block is a piece of the response text, as the API sent it. Line breaks are real line breaks here.
A PDF with a typed cover page and a scanned second page
In
mixed.pdf
Out
SCANNED PAGE BRAVO signed by the inspector
metadata.ocr
false
A scanned PDF page with 10 typed characters
In
t10.pdf
Out
XXXXXXXXXX SCANNED PAGE BRAVO signed by the inspector
metadata.ocr
false
A scanned PDF page with 11 typed characters
In
t11.pdf
Out
XXXXXXXXXXX
metadata.ocr
false
A typed PDF page with a picture of text on it
In
embedded.pdf
Out
Digital report INDIA with a chart below.
metadata.ocr
false
A Word file with a picture between two paragraphs
In
picture.docx
Out
[image: ] Body text ECHO after the picture. image1.png PICTURE WORDS ALPHA Revenue grew 4471 units
metadata.ocr
false
The same Word file as Markdown
In
picture.docx (format=markdown)
Out
# image1.png PICTURE WORDS ALPHA Revenue grew 4471 units
metadata.ocr
false
A PowerPoint slide with a title and a picture
In
picture.pptx
Out
image1.png PICTURE WORDS ALPHA Revenue grew 4471 units
metadata.ocr
false
An Excel sheet with a cell and a picture
In
picture.xlsx
Out
image1.png PICTURE WORDS ALPHA Revenue grew 4471 units
metadata.ocr
false
An HTML page with an inline picture and alt text
In
picture.html
Out
[image: ALT TEXT KILO]PICTURE WORDS ALPHA Revenue grew 4471 units
metadata.ocr
false
An email with an inline picture and alt text
In
picture.eml
Out
[image: ALT TEXT NOVEMBER] PICTURE WORDS ALPHA Revenue grew 4471 units
metadata.ocr
false
A PNG file sent on its own
In
pic.png
Out
PICTURE WORDS ALPHA Revenue grew 4471 units
metadata.ocr
true
What to do about it
A picture on a typed PDF page is lost
Render that page to a PNG and send the PNG. A picture file is always read by OCR. Find the pages at risk first with the PDF text check.
A scan with a footer or stamp is lost
The typed footer pushes the page over 10 characters. Render the page to a PNG and send that. Then the footer is read as part of the picture.
Picture text in an Office file lands at the end
Split the text on the image file name line. The text before the first name is the document. The text after each name belongs to that picture. The snippet below does it.
Do not read metadata.ocr
It says false when OCR ran inside a PDF or an Office file. It says true only for a picture file you send on its own. Check the text, not the flag.
The PDF text check finds pages with no text layer. Run it before you ingest a batch.
Split the picture text from the document text
The picture text starts after a line such as image1.png. This snippet puts each picture under its file name. In your own code, text is the extracted_text field of the response.
Node.js, run on the docx response
import { readFileSync } from "node:fs";
const text = JSON.parse(readFileSync("responses.json", "utf8")).docx.extracted_text;
const parts = text.split(/^(image\d+\.png)$/m);
const document = parts[0].trim();
const pictures = {};
for (let i = 1; i < parts.length; i += 2) {
pictures[parts[i]] = parts[i + 1].trim();
}
console.log(JSON.stringify({ document, pictures }));It printed
{"document":"Body text CHARLIE before the picture.\n[image: ]\nBody text ECHO after the picture.","pictures":{"image1.png":"PICTURE WORDS ALPHA\nRevenue grew 4471 units"}}The file name is a label. It does not tell you where the picture sat on the page.
What we did not test
We tested uploaded files with printed text in the pictures. We did not test handwriting in a picture. Read Handwriting for that. We did not test a page that txtfetch fetches from a URL.
The flag metadata.ocr reports false when OCR ran inside a PDF or an Office file. This is a known gap in the API.
?quality=premium is sold as a tier, but it does not run today. VLM_ENABLED defaults to false, and no operator has switched the tier on in production. A premium request downgrades to the standard Tika path instead.
Read the PDF page, the scanned PDF page, the Word page and the image page for the rest of each format.
Frequently asked questions
- Does the text in a picture come back?
- Most of it does. A scan, or a picture in Word, PowerPoint, Excel, HTML or email, is read by OCR. A picture on a typed PDF page is not. A PDF page with more than 10 typed characters is not read either.
- When does txtfetch read a PDF page with OCR?
- It decides page by page. A page with 10 typed characters or fewer is read by OCR. A page with more is not. A typed cover page and a scanned body both come back.
- Why is the text of my scanned page missing?
- The page probably holds a typed footer, a page number line or a stamp of more than 10 characters. Then only the typed text comes back. Render the page to a PNG and send the PNG.
- Where does the text from a picture in a Word file appear?
- At the end of the document, after a line with the picture file name, such as image1.png. In Markdown the name is a heading. In JSON it is a heading element.
- Is the alt text of a picture kept?
- In HTML and email, yes. It comes back in an [image: ] marker. In Word, PowerPoint and Excel, no. Word shows an empty marker.
- Does metadata.ocr tell me that OCR ran?
- No. It said false in every test except a picture file sent on its own. Do not use it to detect OCR. Read the text.
Watch it run, then take a key.
The playground replays a real recorded response for every sample document.
Open the playground →