DEV Community

Cover image for Your full-page screenshot is 355px wide inside Claude
Alex @Bickov
Alex @Bickov

Posted on

Your full-page screenshot is 355px wide inside Claude

A full-page screenshot looks like the perfect thing to give a coding agent, since the whole page fits in one image.

Claude never reads that image at the size you took it. The test below uses one capture of a long article page: 1270px wide at 2x, so the PNG is 2540 x 18410.

What Claude does with a tall image

Claude caps the long edge of every image at 2576px and keeps the aspect ratio. On a normal screenshot that is harmless. On a tall page the long edge is the height, so the width goes down with it.

2540 x 18410 becomes 355 x 2576. Body text that was 16px in the file lands at about 2.2px.

A 2540 x 18410 capture shrinks to 355 x 2576 inside Claude

Here is the same line of text after that resize, scaled back up so you can see it:

The same 16px line before and after the resize

The model still answers questions about the page. It just answers from blur, and nothing in the reply tells you so.

The token numbers

Anthropic's image formula for Claude 4.7 is ceil(width / 28) x ceil(height / 28) tokens, after the resize.

What you send Tokens Can it read 16px text?
One tall image, 355 x 2576 1,196 No, about 2.2px
11 frames, 1270 x 900 (last one shorter) 15,548 Yes
Page text only about 3,300 (estimate) Yes, exact strings

Token cost of three ways to send one tall page

The tall image is the cheapest row because most of the pixels are thrown away before the model sees them.

Frames keep the text readable, at 13x the tokens. Past 20 images in one request Claude also drops the per-image limit to 2000px, so a really long page cut into frames runs into a second wall.

The text row costs about a fifth of the frames and gives the model the exact strings: error messages and button labels. What it loses is the layout and anything drawn instead of written.

What works

Send the text and only the frames that matter. One frame for the part of the layout in question, plus the page text as plain data, beats both the tall image and the full stack of frames.

Viewport screenshots are fine as they are. Odilon Hugonnot's ticket workflow with Claude Code checks proof screenshots at 390 x 844, 820 x 1180 and 1280 x 900. All three sit under the 2576px edge, so nothing gets crushed. The trouble starts only when one capture holds the whole page.

Free tools that capture text next to the image include SlimSnap, which saves a full-page capture as frames plus a JSON file with the page text and element positions. Playwright can do the same in a script with page.screenshot() per viewport and innerText for the text.

Run the test yourself

The numbers above come from the formula. To get real counts from the API for your own page, save a full-page PNG and its text, then run:

pip3 install pillow
ANTHROPIC_API_KEY=your_key python3 measure_tall.py tall.png page.txt
Enter fullscreen mode Exit fullscreen mode

The script sends each version to the count_tokens endpoint, which counts tokens without running the model, and prints one line per row of the table.

measure_tall.py
# Real token test for one tall screenshot.
# Usage: ANTHROPIC_API_KEY=... python3 measure_tall.py tall.png page.txt [model]
import base64, io, json, math, sys, urllib.request
from PIL import Image

png, txt = sys.argv[1], sys.argv[2]
model = sys.argv[3] if len(sys.argv) > 3 else "claude-opus-4-7"
key = __import__("os").environ["ANTHROPIC_API_KEY"]

def count(content):
    body = json.dumps({"model": model, "messages": [{"role": "user", "content": content}]}).encode()
    req = urllib.request.Request("https://api.anthropic.com/v1/messages/count_tokens", body, {
        "x-api-key": key, "anthropic-version": "2023-06-01", "content-type": "application/json"})
    return json.load(urllib.request.urlopen(req))["input_tokens"]

def img(im):
    b = io.BytesIO(); im.save(b, "PNG")
    return {"type": "image", "source": {"type": "base64", "media_type": "image/png",
            "data": base64.b64encode(b.getvalue()).decode()}}

base = count([{"type": "text", "text": "x"}])
im = Image.open(png).convert("RGB")
w, h = im.size
print(f"capture {w}x{h}")

# 1. one tall image (shrink it ourselves to the 2576px long edge so the API accepts it)
s = min(1, 2576 / max(w, h))
tall = im.resize((round(w * s), round(h * s)), Image.LANCZOS)
print(f"one tall image  {tall.size[0]}x{tall.size[1]}  {count([img(tall), {'type': 'text', 'text': 'x'}]) - base} tokens")

# 2. frames at 1x, 900px tall
one = im.resize((w // 2, h // 2), Image.LANCZOS)
frames = [one.crop((0, y, one.width, min(y + 900, one.height))) for y in range(0, one.height, 900)]
print(f"{len(frames)} frames {one.width}x900  {count([img(f) for f in frames] + [{'type': 'text', 'text': 'x'}]) - base} tokens")

# 3. page text
text = open(txt, encoding="utf-8").read()
print(f"page text {len(text)} chars  {count([{'type': 'text', 'text': text}]) - base + 0} tokens")
Enter fullscreen mode Exit fullscreen mode

To check the resize without any API, paste a long screenshot into Claude and ask what size the image is. It reports the shrunk size, not the one you sent.

Top comments (0)