Module 1 · Lesson 6 of 6
Images and PDFs as input
- Contract PDF — 10 pages — healthy
- App — prepares the file — healthy — NOW — text + a table
- Model — reads text and images — healthy
- File or prompt
- Answer
Step 1 of 4 · App
Done: A 10-page contract arrives as a PDF
- What happens
- Each page holds about 500 words. Page 7 also holds a signed table.
- Why
- A PDF can hold real text, pictures of pages, or both.
- What changes
- The app decides how to send it.
- Next
- Each page becomes an image of 1,000 × 1,400 pixels
Event log
3 more to go. Press a line to go back to that step.
Tokens for each page
The app has not prepared the pages yet.
Step 1 of 4: App. A 10-page contract arrives as a PDF. Each page holds about 500 words. Page 7 also holds a signed table.
What this simplifies. The page sizes, words and price are examples. Image tokens use one provider's published rule of thumb, about width × height ÷ 750; others count differently, and most shrink very large images first.
Many models read images as well as text. An image is cut into small patches, and the patches are counted as (A piece of text that a language model reads or writes, often part of a word. Prices and limits are counted in tokens.), like words. So a bigger picture costs more tokens, takes more of the (The most tokens a model can read at once, counting both the prompt and the answer.), and takes longer to read.
A PDF can hold real text, pictures of pages, or both. Text pulled from it is the cheapest way to send words, but it loses layout: a table becomes loose numbers, and a signature disappears.
A scanned PDF has no text at all, only pictures of text. It must go as images, or through OCR first: a step that reads the text out of the pictures.
The usual plan is text where words are enough. Add an image only where the layout matters, such as a table, a chart or a signature. Shrink images to the size the question needs.
In system design: Count image tokens before you send them, send text where words are enough, and add images only where the layout matters.