Skip to content
AgenticAIWiki
  1. Learn
  2. Part 1
  3. 8. Multimodal and voice
  4. 8.1

Lesson 8.1 · 1 of 9 · 4 min read · Reviewed 24 Nov 2026

How models read images and documents

By the end, you can

  • Explain how models read images and documents.
  • Know what vision models are good and bad at.

From pixels to tokens

image --> split into patches --> each patch becomes a vector --> image tokens
                                                                    |
text tokens -------------------------------------------------------+--> model

The model attends to image and text tokensToken: The unit a model reads and writes: a word, part of a word, a space or a symbol, mapped to an integer id. together, so it can answer questions that mix them: “What’s the total on this receipt?”

Strengths and limits

Good at Weaker at
Reading printed and clear handwritten text Exact counts of many small objects
Describing scenes and objects Precise spatial positions and measurements
Understanding charts, tables, forms Tiny or blurry text
Comparing several images Identifying specific people (and Claude won’t do it)
Screenshots of apps and websites Very large images, which are downscaled

Documents

PDFs can be processed as page images plus extracted text, so the model sees both layout (tables, charts) and text (8.5).

Tips

  • Send images at a reasonable resolution; huge images are resized and cost more tokens (3.3).
  • Put the image before the question in the message.
  • Ask for the text to be transcribed first when exact details matter, then reason over the transcription.

Key points

  • Vision models split an image into patches, turn them into tokens, and process them alongside text.
  • They're good at reading text in images, describing scenes, charts and layouts.
  • They can struggle with exact counting, precise positions, tiny text and very low-quality scans.
Hands-on labRuns in the Playground

Budget image tokens before you send

Estimate what a batch of images will cost in tokens and cut it by resizing to the detail you need.

You will have: A script that estimates tokens per image before and after resizing, with the total saving as a ratio.

Steps

  1. Run the starter: it prints each photo's size but no token estimates.
  2. Fill in tokens(): use the rule of thumb width x height / 750 (one provider's published estimate; check yours).
  3. Fill in resize(): scale so the long edge is at most MAX_EDGE, keeping the aspect ratio.
  4. Print tokens before and after for each image, and the total saving.
  5. Pick a smaller MAX_EDGE for the screenshot-only batch and check the text would still be legible.

Done when

  • The 4000 x 3000 photo is resized to 1568 x 1176.
  • Every resized image has a long edge of 1568 or less.
  • The script prints the total saving as a ratio '4.5x fewer tokens'.

Open in the Playground No API key needed.

Starter code (Python)
MAX_EDGE = 1568  # example value: take this from your provider's vision docs
IMAGES = {"receipt.jpg": (3000, 4000), "shelf.jpg": (4000, 3000), "screenshot.png": (1280, 800), "chart.png": (2400, 1600)}

def tokens(w, h):
    return 0  # TODO: round(w * h / 750)

def resize(w, h):
    return w, h  # TODO: scale down so max(w, h) <= MAX_EDGE, keep the aspect ratio

for name, (w, h) in IMAGES.items():
    print(name, (w, h), "->", resize(w, h), "tokens:", tokens(w, h), "->", tokens(*resize(w, h)))
Show a solution
MAX_EDGE = 1568
IMAGES = {"receipt.jpg": (3000, 4000), "shelf.jpg": (4000, 3000), "screenshot.png": (1280, 800), "chart.png": (2400, 1600)}

def tokens(w, h):
    return round(w * h / 750)

def resize(w, h):
    scale = min(1.0, MAX_EDGE / max(w, h))
    return round(w * scale), round(h * scale)

before = after = 0
for name, (w, h) in IMAGES.items():
    nw, nh = resize(w, h)
    before += tokens(w, h)
    after += tokens(nw, nh)
    print(f"{name:15} {w}x{h} -> {nw}x{nh}  tokens {tokens(w, h):>6} -> {tokens(nw, nh):>5}")
print(f"total: {before} -> {after} tokens, {before / after:.1f}x fewer tokens")
Quick checkWhich task is a vision model most likely to get wrong?
How sure are you?
Pick an answer and how sure you are