Skip to content

Feature request: Image resize/maxBytes option for Read tool #8080

@Enashka

Description

@Enashka

Problem

When an agent uses the Read tool on large images, the full image is sent to the model, consuming significant context tokens. This can contribute to context overflow, especially in sessions with multiple image operations.

Current Workaround

I've created a wrapper script (view-image) that:

  1. Checks image dimensions and file size
  2. Creates a thumbnail if the image exceeds thresholds
  3. Returns the path to use (original or thumbnail)

But this requires the agent to remember to use the script — there's no automatic interception.

Proposed Solution

Add optional image preprocessing for the Read tool:

{
  tools: {
    read: {
      imageMaxBytes: 2097152,  // 2MB max
      imageMaxDimension: 1024, // resize if larger
      imageQuality: 85         // JPEG quality for resized images
    }
  }
}

When Read encounters an image exceeding these limits, it would automatically resize before sending to the model.

Benefits

  • Prevents context bloat from accidental large image views
  • No agent-side discipline required
  • Configurable per user's needs
  • Similar to existing mediaMaxMb on channels

Environment

  • OpenClaw version: 2026.1.30
  • Related: context overflow issues with image-heavy sessions

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions