Skip to content
dsh.fish
Bundle

dsh-picture-fit

DSH plugin: auto-downscale oversized images (and a portable Agent Skill). Powered by sharp. Install from GitHub — no npm publish.

Source
cyanfish-x
stars
1 stars
License
MIT
Updated
Updated 13 days ago

Readme

# dsh-picture-fit

中文 | [English](README.en.md)

dsh图片大小自动压缩预处理插件,解决dsh聊天框携带过大图片时,调用 **deepseek-v4-flash-vision-exp** 模型报错的问题;

粘贴 / 拖拽 / 选文件插入图片时,插件会把超限大图自动缩边压缩,避免「图片宽高不能超过 2000px」被拒。同仓附带跨 Agent 的 **Skill**(Codex / Claude Code / Cursor 等)。

## 问题描述

粘贴超限大图时,dsh会直接拒绝:

![图片宽高不能超过 2000px](images/bug.jpg)

- DSH 默认拒绝单边 **>2000px** 的图。
- DeepSeek Vision 官方单边上限更高(**8192** / 多图时 **4096**),见 [图像理解 · 限制](https://api-docs.deepseek.com/zh-cn/guides/vision)。
- 宿主选择拒绝而非自动缩图;本插件补上自动 fit。

## 安装(DSH Web)

### 提示词安装(推荐)

把下面整段复制发给任意 Agent,让它代为安装:

```text
请帮我安装 DSH 插件 dsh-picture-fit(超限图片自动缩边压缩):

1. 确认本机已安装 dsh CLI,且能执行 `dsh --help`
2. 执行:dsh plugin --profile web add github:cyanfish-x/dsh-picture-fit
3. 安装成功后提醒我重启 dsh web(或帮我重启,若你能操作该进程)
4. 安装完成后说明:设置 → 图片压缩 可开关与覆盖最大边长

仓库:https://github.com/cyanfish-x/dsh-picture-fit
```

### 命令行安装

```bash
dsh plugin --profile web add github:cyanfish-x/dsh-picture-fit
```

重启 `dsh web`。

## 设置

入口:**设置 → 图片压缩**。

![图片压缩设置页](images/image.png)

| 配置             | 默认          | 说明                |
| -------------- | ----------- | ----------------- |
| `enabled`      | `true`      | 超限时自动缩边           |
| `maxDimension` | `null`(跟宿主) | 覆盖最大边长;宿主常见为 2000 |


`enabled: false` 时与官方拒绝超限图行为一致。只存缩后图;不碰 MCP / 其他插件自管图。

## Agent Skill

见 [skill/SKILL.md](skill/SKILL.md)。仓库内:

```bash
npm install
node skill/scripts/fit.mjs ./big.png ./big.fit.png --max 2000
```

## 许可

MIT。依赖 [sharp](https://github.com/lovell/sharp)(Apache-2.0)。

Install

dsh plugin --profile web add github:cyanfish-x/dsh-picture-fit

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source