dsh-image-forge: Generating Images and Image-to-Image Editing with Qwen-Image in DSH

Introduction

When building agents in DeepSeek Harness, common requirements include having the model “generate an image with a single sentence” or “modify a reference image based on instructions”. Dimensions and pixels often need to align with the model’s contract, and the backend may switch between cloud APIs and a local ComfyUI instance. Assembling HTTP requests, looking up width/height tables, and distinguishing between text-to-image and image-editing channels yourself takes up significant integration time.

Below is the community plugin dsh-image-forge (maintainer: Demerier, category: model inference). It integrates Qwen-Image 2.1’s text-to-image and reference image editing into the DSH toolchain, supports choosing between the official cloud API and local ComfyUI (or an auto combination), and makes contracts like wh_ratio first-class parameters. The plugin does not bundle its own runtime and does not download weights.

What Is This

dsh-image-forge is a DeepSeek Harness plugin that uses Qwen-Image for text-to-image and reference image editing, with optional ComfyUI or official API backends. Once installed, three tools appear in conversations: qwen_image_generate, qwen_image_edit, and qwen_image_status, and a “Qwen Image Generation” workbench appears on the left side of the settings page.

Repository: https://github.com/Demerier/dsh-image-forge
Community directory page: https://www.skillhub.cn/plugins/Demerier/dsh-image-forge
Current package version (package.json): 0.2.0, plugin itself licensed under MIT.

Core Features

Backend and Capability Matrix

What You Have What You Can Do
Only a cloud API key Text-to-image; image editing not available (cloud API has no editing channel)
Only ComfyUI (with required weights) Image generation + image editing, fully offline
Both Image generation can use the key, image editing automatically falls back to ComfyUI
Neither You need to deploy ComfyUI according to the repository documentation first

backend defaults to auto: if you have a key, it uses the cloud API; otherwise, it uses ComfyUI. Image editing only works via ComfyUI; if you specify backend: "api" with reference images, it will explicitly error out rather than silently drop images.

Text-to-Image

Simply describe your needs in the conversation; the model will rewrite your request into the contract format before calling the tool. Aspect ratios are converted by the plugin into approximately 1.5MP, 32-aligned pixel dimensions, with seven wh_ratio options: 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16. When fixed pixels are needed, you can pass width / height (multiples of 32), which take precedence over wh_ratio.

Generated files are saved by default to ~/Pictures/dsh-image-forge, with filenames like <prefix>_<W>x<H>_<n>.png. The numbering skips already occupied names, so regenerating images does not overwrite old files.

Image Editing

Providing a reference image enters the image editing task. Reference paths must be absolute paths, and only PNG / JPEG / WebP are recognized. Canvas rules (choose one of three): explicitly state the ratio or pixels; or use ratio_follow: "image1" to follow a specific image’s aspect ratio; if neither is passed, it follows the first reference image. wh_ratio and ratio_follow cannot be passed simultaneously. For multiple reference images, use <image1>, <image2> to describe their purposes and indicate the canvas.

Workbench and Canvas

The first tab in the settings page is the workbench: seven canvas sizes, up to 10 reference images (providing images triggers image editing), optional “prompt optimization” (depends on the host having @deepseek-ai/dsh-llm installed; if missing, only that button is unavailable). Results are displayed on a canvas, supporting archiving by board and linking multiple calls via the board parameter. Environment diagnostics can call qwen_image_status (does not generate images or write to disk).

Configuration Essentials (Daily Six)

For other fields, see the repository’s docs/configuration.md (14 items total, all with default values).

Field Default Description
backend auto auto / api / comfyui
apiKey empty Recommend leaving empty, use environment variables
comfyEndpoint empty e.g., http://127.0.0.1:8188; leave empty for auto-detection; non-loopback addresses will be rejected
comfyModelsDir auto-detect Mainly affects path hints in error messages
comfyModel base turbo (8 steps) or base (25 steps)
outputDir ~/Pictures/dsh-image-forge Output directory

API Key reading order: apiKey → QWEN_IMAGE_API_KEY → DASHSCOPE_API_KEY → OPENAI_API_KEY.

Installation and Activation

Run the official installation command in the target profile (restart DSH after installation):

dsh plugin --profile <profile> add github:Demerier/dsh-image-forge

When modifying plugin source code locally, run pnpm install and pnpm build in the repository, then use the repository’s absolute path with add. Do not use npm install to install the plugin separately—it depends on the DSH host. If pnpm build reports Cannot find package 'ansis', you can delete node_modules and reinstall (the repository uses nodeLinker: hoisted).

Security Note: The plugin runs with the permissions of the current DSH process, reading and writing to your configured output directory and accessing local ComfyUI or cloud APIs. Before installation, please read the repository source code and the MIT License; Qwen-Image weights are subject to the Qwen RESEARCH LICENSE, commercial use requires obtaining authorization yourself, and the plugin does not distribute weights with the package.

Typical Usage

Generating Images in Conversation

Simply state your needs, e.g., “Draw a 16:9 summer beverage poster”. Tool-side contract example:

{"rewritten_prompt": "A wide photograph of …", "wh_ratio": "16:9"}

Editing Images in Conversation

Provide reference images and editing instructions, e.g., change the living room to nighttime. Tool call format example:

qwen_image_edit(prompt = <editing instructions>, images = ["D:\\pictures\\room.png"], ratio_follow = "image1")

Troubleshooting

When unsure if the environment is ready, first ask the model to call qwen_image_status to check cloud API, ComfyUI, weight recognition, VRAM, and output directory writability.

Use Cases and Considerations

Suitable for: Users already using DSH for agents who need Qwen-Image 2.1 text-to-image; users with ComfyUI and weights who also want reference image editing; users who want to manage generated images with a workbench and boards rather than manually writing pixel parameters each time.

Not suitable for or limitations to note:

  • Image editing is not available with only a cloud key and no ComfyUI.
  • No inpainting, no upscaling; the assets page focuses on retrieval and organization, not batch export or color grading.
  • The plugin does not install ComfyUI or download weights; insufficient VRAM typically results from ComfyUI-side CUDA OOM.
  • Image display in conversations depends on the Markdown absolute paths returned by the tool.

The ComfyUI backend and workflow placeholder protocol are referenced and ported from dsh-image-gen (Apache-2.0); see THIRD-PARTY in the repository for details.

Conclusion

dsh-image-forge encapsulates Qwen-Image’s image generation contracts, dual backend routing, and image editing constraints into DSH tools and the workbench, making it suitable for developers who need both conversational image generation and local ComfyUI image editing. For more deployment and field descriptions, see the docs/ directory in the GitHub repository.

羽毛球分组比赛记分
小程序二维码

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

Xiaoye