~/academy $ claude learn images-and-vision
Images and vision in the Claude API
How to send images to the Claude API, the size limits and token cost of each image, and what Claude vision is good and bad at. 7 min
$ Read
Sending an image
An image goes in an image content block with a base64, url or file (Files API) source. Supported formats are JPEG, PNG, GIF and WebP. As with documents, put the image before your question.
import base64
import anthropic
client = anthropic.Anthropic()
with open("receipt.jpg", "rb") as f:
image_data = base64.standard_b64encode(f.read()).decode("utf-8")
message = client.messages.create(
model="claude-opus-5-5",
max_tokens=1024,
messages=[{
"role": "user",
"content": [
{"type": "image", "source": {"type": "base64", "media_type": "image/jpeg", "data": image_data}},
{"type": "text", "text": "List the supplier, date, total and VAT shown on this receipt."},
],
}],
){"type": "image", "source": {"type": "url", "url": "https://example.com/chart.png"}}Lesson notes: Images and vision in the Claude API
Everything in this lesson as text, for revision or to read without the interactive steps. By the end you will be able to: You send images from your app, size them to control cost, and avoid the jobs vision should not be trusted with.
Step 1 of 6 · Read
Sending an image
An image goes in an
imagecontent block with abase64,urlorfile(Files API) source. Supported formats are JPEG, PNG, GIF and WebP. As with documents, put the image before your question.A local photo import base64 import anthropic client = anthropic.Anthropic() with open("receipt.jpg", "rb") as f: image_data = base64.standard_b64encode(f.read()).decode("utf-8") message = client.messages.create( model="claude-opus-5-5", max_tokens=1024, messages=[{ "role": "user", "content": [ {"type": "image", "source": {"type": "base64", "media_type": "image/jpeg", "data": image_data}}, {"type": "text", "text": "List the supplier, date, total and VAT shown on this receipt."}, ], }], )An image by URL {"type": "image", "source": {"type": "url", "url": "https://example.com/chart.png"}}Step 2 of 6 · Read
Limits and cost (checked 18 November 2026)
Each image can be up to 10 MB (base64-encoded) on the Claude API and up to 8000 x 8000 pixels. A request can hold up to 600 images (100 on models with a 200K context window). Above 20 images a stricter size limit applies, so keep each image under 3,000 pixels on both sides.
Claude reads images in 28 x 28 pixel patches, one visual token each: roughly (width / 28, rounded up) times (height / 28, rounded up). Claude 4.7 and later models, including all current ones, use a high-resolution tier of up to 2,576 pixels on the long edge and 4,784 tokens. Bigger images are scaled down to fit.
A 1000 x 1000 image is 1,296 tokens, about $5.18 per thousand images on Opus 5.5. A 4K screenshot hits the 4,784 cap. If you do not need fine detail, resize before sending: it is cheaper and faster.
Step 3 of 6 · Read
Good at, and not to be trusted with
Vision is strong at reading documents, receipts, charts, diagrams and screenshots, and at describing what an image shows. High resolution helps with dense documents and screen reading.
The docs list clear limits. Claude will not name people in images. It can make mistakes on low-quality, rotated or very small images (under 200 pixels). Positions and coordinates are approximate, and counts of many small objects may be off. It cannot tell whether an image is AI-generated, and it is not designed to interpret diagnostic scans such as CTs or MRIs.
Practical fixes: crop to the part that matters, rotate images upright, and avoid heavy JPEG compression that blurs text. Check the image you actually sent, not the original.
Step 4 of 6 · Sort
Good fit or poor fit?
Decide whether each task suits Claude vision.
- Pull the line items from a clear receipt photo
- Name the people in a team photo
- Decide whether a product photo is AI-generated
- Summarise the trend in a chart from a quarterly report
- Count exactly 312 screws in a bin
- Describe the error message in a UI screenshot
Show the answers
- Pull the line items from a clear receipt photo: Good fit. Reading printed text from a clear image is a strength.
- Name the people in a team photo: Poor fit. Claude refuses to identify people in images.
- Decide whether a product photo is AI-generated: Poor fit. The docs say not to rely on it for detecting synthetic images.
- Summarise the trend in a chart from a quarterly report: Good fit. Charts and diagrams are well within its abilities.
- Count exactly 312 screws in a bin: Poor fit. Counts of many small objects are approximate.
- Describe the error message in a UI screenshot: Good fit. Screenshot understanding is a listed strength.
Step 5 of 6 · Quiz
Check your understanding
About how many visual tokens does a 1092 x 1092 pixel image use?
- About 600
- About 4,784
- About 1.2 million
- About 1,521
Show the answer
About 1,521 1092 / 28 = 39, and 39 x 39 = 1,521 tokens. It is under the size limit, so it is not resized.
Step 6 of 6 · Quiz
Check your understanding
Your app sends full 1920 x 1080 screenshots so Claude can tell users which page they are on. Each costs 2,691 tokens. What do you change?
- Resize or crop the screenshots before sending them.
- Switch to PDF.
- Nothing, image tokens are free.
Show the answer
Resize or crop the screenshots before sending them. The docs recommend downsampling when you do not need full detail. You pay per patch, so smaller images cost less and respond faster.