dshx-image-clamp: Resizing the image long side to within 2000px before sending to the model

Introduction

When building multi-image conversations or agents with screenshots in DeepSeek Harness (DSH), images go through attachment normalization before entering the model context. Claude has a hard limit for multi-image requests: if there are more than 20 images in a single request, or if any image has a side length exceeding 2000 pixels, the entire request will be rejected. Furthermore, the rejected image will be replayed in every subsequent turn, causing the session to fail repeatedly.

DSH’s built-in attachment normalization primarily constrains the total number of pixels, but a single side can still exceed 2000 (e.g., 2730×1536). Below is an introduction to the community plugin dshx-image-clamp (maintainer callaumyan-design), which handles long-side and byte limits before images are actually sent to any provider, without modifying the original images on disk.

What is this

dshx-image-clamp is a Cordis plugin within the DSH ecosystem, categorized under model inference. It wraps the host-provided attachments.readImage to in real-time resize dimensions and control the size of individual images along the path of reading images and encoding them into requests. By default, the long side is capped at 2000px, and the encoded size is capped at approximately 180 KB. Disabling the plugin results in behavior identical to when it is not installed.

Core Features

  1. Long-side limit: Limits the maximum pixel length of the image’s long side via the maxSide configuration (default 2000).
  2. Per-image byte budget: Limits the size of a single encoded image via maxBytes (default 184320, i.e., 180 KB).
  3. No modification of original files: Processing occurs in memory and within the sending pipeline; attachments on disk remain untouched.
  4. Depends on sharp: Uses the sharp library already bundled with DSH for scaling. If sharp is not found at runtime, the plugin logs a warning and does not process the image.

Installation and Activation

The plugin supports headless, web, and desktop profiles. A restart of DSH is required after installation (requiresRestart: true).

Web environment:

dsh plugin --profile web add github:callaumyan-design/dshx-image-clamp

Desktop environment (using the dsh command bundled with DSH Desktop; please fully exit the Desktop from the system tray before installing):

dsh plugin --profile desktop add github:callaumyan-design/dshx-image-clamp

Restart DSH after installation is complete. Example for uninstallation:

dsh plugin --profile <profile> remove dshx-image-clamp

Configuration

The following fields can be adjusted in the plugin’s cordis.patch.yml (or merged into your Cordis patch following DSH plugin configuration methods):

Field Default Description
maxSide 2000 Long side limit (pixels)
maxBytes 184320 Maximum byte limit for a single encoded image (180 KB)

You can adjust these values as needed; the default values correspond to the common settings for Claude’s multi-image side length limits mentioned in the README.

Typical Usage

This plugin does not have separate CLI or API invocation steps: once installed and restarted, any image sent to the model via the DSH attachment pipeline will automatically pass through the readImage wrapping logic. During development and debugging, you can continue to drag-and-drop, paste, or reference local images as usual. If a session was previously rejected entirely due to “multiple images + side exceeding 2000px”, installing this plugin should prevent the same type of error from repeatedly interrupting the conversation.

Use Cases and Caveats

Who it is for: Developers who frequently send multiple screenshots, design drafts, or log images to Claude (or other providers using the same attachment reading path) in DSH; specifically for scenarios requiring “side length ≤ 2000px” and control over individual image size.

Compatibility: The README states it is developed and used on DeepSeek Harness 0.2.0-rc.2 (desktop / web profiles). The implementation is pure JavaScript with no build steps or installation scripts. The current package version is 1.1.0, licensed under MIT.

Security and Permissions: Like other DSH plugins, the code runs with the permissions of the current dsh process. It is recommended to review the source code and license on GitHub before installation to ensure it complies with your environment policies. The community directory site SkillHub and DeepSeek / High-Flyer have no official affiliation; this plugin comes from a community maintainer, not the official app store.

Conclusion

dshx-image-clamp solves the specific pipeline issue of “entire request failure caused by excessive side length in multi-image sessions”. It clamps the long side and byte size before sending, without touching the original images. For installation commands, configuration options, and background information, please refer to:

  • Directory Page: https://www.skillhub.cn/plugins/callaumyan-design/dshx-image-clamp
  • Repository: https://github.com/callaumyan-design/dshx-image-clamp
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye