Skip to content

Validate image dimensions before sending to prevent API errors #1699

@ethanndickson

Description

@ethanndickson

Problem

When users upload large images (>2000px) and have >20 images in a conversation, Anthropic rejects the request:

At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels

This error persists in history, blocking subsequent messages until manually removed.

Proposed Solution

Add frontend validation to auto-resize images on paste/drop:

  1. Extract dimensions when creating ImageAttachment (decode base64 → Image element → naturalWidth/Height)
  2. Auto-resize to 2000px if larger (canvas downscale, preserve aspect ratio)
  3. Show indicator when image was resized: "Image resized from 4000×3000 to 2000×1500"

Provider Limits Reference

Provider Single Image Many-Image (>20)
Anthropic 8000px 2000px
OpenAI 2000px 2000px
Google 8000px 8000px

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions