In agent development, you often need to process local images by reading their dimensions or converting their formats (such as PNG to WebP). Manually writing processing scripts increases development costs. DSH’s plugin ecosystem provides local processing capabilities, and dsh-image is a tool in it specifically designed for image processing.

What It Is

dsh-image is a plugin implemented in pure Node.js, based on a bundled ffmpeg binary file, with cross-platform support. It provides simple interfaces for retrieving image information or performing resizing and format conversion operations.

Core Features

The plugin provides the following tools:

  • image_info: Reads the width, height, and format of an image.
  • resize_image: Resizes an image (supports proportional scaling or specified dimensions) and supports format conversion (jpg/png/webp).

Installation and Activation

The installation command is as follows:

dsh plugin add dsh-image

After installation, the plugin is registered in the current session.

Typical Usage

The following example shows how to resize an image and convert its format:

// 把 hero.png 缩成 800 宽并转成 webp
resize_image(file="hero.png", width=800, outFile="hero.webp")

Use Cases and Notes

This plugin is suitable for agent development scenarios that require quickly processing local images within DSH sessions.

Security Notice:
Installing it runs third-party code on your local machine. Please review the source code and license yourself.

Summary

dsh-image solves local image processing dependency issues by integrating ffmpeg. For more details, refer to the plugin directory or the GitHub source code.