GrepBoard/Manuals
605 manuals ·

Fix Claude Code "image dimensions exceed max allowed size"

·Tested on Ubuntu 24.04 · ImageMagick 6.9.12 (Docker) · Claude Code official docs · 2026-10·Test scope ↓·5 steps

Claude Code 400 image dimensions exceed max allowed size means an image is over the pixel limit. Resize under 2000px and /rewind past it in history.

output
API Error: 400 ... image dimensions exceed max allowed size

An image you pasted or attached is wider or taller than the API allows; resize it so the longest edge is 2000px or less and attach it again. But once a rejected image stays in the conversation history, every later message can fail the same way, so removing it from history is a separate step.

[1] Read the whole message to tell which case you are in.

Text in the messageCase
image dimensions exceed max allowed sizeA single image is over the limit
... for many-image requests: 2000 pixelsMore than 20 images (plus document blocks on Bedrock and Google managed) in one request, so a lower limit applies
Unable to resize image — dimensions exceed the 2000x2000px limit and image processing failedClaude Code tried to downscale automatically and failed
Image was too large. Double press esc to go back ...Rejected right after pasting; press Esc twice and try a smaller image

Per the Claude API docs, a single image can be up to 8000x8000px, but when one request holds more than 20 images, a lower per-image limit applies to every image in it. Images from earlier turns and screenshots returned in tool results count toward those 20. On Amazon Bedrock and Claude Models on Google Cloud (Google managed), document blocks such as PDFs count too, so a request with 20 or fewer images can still hit the lower limit if it also carries PDFs. The message states that limit in pixels, and the docs say that to stay under it on every platform, keep both dimensions at 2000px or less.

[2] Check the image size. ImageMagick's identify prints width x height.

console
$ identify -format "%f %wx%h\n" screenshot.pngscreenshot.png 3840x2160

A full 4K screen capture is 3840x2160. Sent alone it passes the 8000px limit, but once the conversation piles up more than 20 images, it can hit the lower limit. Read that limit from the number in the error message, and resize to 2000px or less to pass on every platform.

[3] Shrink the longest edge to 2000px. The > in 2000x2000> means shrink only if larger, so images already small are left alone.

console
$ convert screenshot.png -resize "2000x2000>" screenshot-2000.png$ identify -format "%f %wx%h\n" screenshot-2000.png small.pngscreenshot-2000.png 2000x1125small.png 1200x800$ convert small.png -resize "2000x2000>" small-out.png$ identify -format "%f %wx%h\n" small-out.pngsmall-out.png 1200x800

The aspect ratio is kept (3840x2160 → 2000x1125) and the 1200x800 image is untouched. If you don't need the whole screen, capture just the region you need; the text stays more legible too.

When an Unable to resize image message asks for a different format, re-save as PNG, JPEG, GIF, or WebP. The message names the cause: a CMYK JPEG should become an RGB PNG or JPEG, and an animated WebP should be saved as its first frame in PNG.

[4] If the same error repeats on every message, take the image out of history. Run /rewind, or press Esc twice with an empty input, pick a point before the prompt that carried the image, and choose Restore conversation. That rewinds the conversation only and leaves files alone. Then send the resized image.

If rewinding is awkward, clear the conversation with /clear or open a new session. Official repository issues #16173 and #13480 report that every message failed in this state and only a new conversation got out of it.

[5] Update if your version is old. The docs say that before v2.1.166 a pasted image could stay in the conversation and repeat the error, and before v2.1.299 long conversations with many images could drop your latest images instead of the oversized one, and images attached in VS Code or the Desktop app while Claude was working reached the API at full size.

console
$ claude --version$ claude update

Work that keeps receiving screenshots as tool results, such as a browser automation MCP, crosses 20 images quickly. The message quoted in issue #54346 read Run /compact to remove old images from context, or start a new session. If the tool lets you lower its screenshot resolution, change that first.

#claude-code#image#screenshot#api-error