Skip to content

Conversation

@sawyer-shi
Copy link
Contributor

@sawyer-shi sawyer-shi commented Jan 6, 2026

Image Toolbox

A powerful Dify plugin providing comprehensive local image processing capabilities. All image operations are executed entirely on your local machine without any external services, API keys, or internet connections, ensuring maximum data security and privacy. Supports adding watermarks (text and icon), resizing images (crop and pad), and converting between multiple image formats (JPG, PNG, WEBP, BMP, TIFF, GIF, ICO, SVG).

Version Information

  • Current Version: v0.0.1
  • Release Date: 2026-01-02
  • Compatibility: Dify Plugin Framework
  • Python Version: 3.12

Version History

  • v0.0.1 (2026-01-02): Initial version with watermark, resize, and format conversion features

Quick Start

  1. Download the image_toolbox plugin from Dify marketplace
  2. Install the plugin in your Dify environment
  3. Start processing your images immediately
Chinese English

Core Features

  • 100% Local Processing: All image operations are executed entirely on your local machine
  • No External Services: No need to connect to any external services or third-party APIs
  • No API Keys Required: Completely free to use without any API key configuration
  • Maximum Data Security: Your images never leave your local environment, ensuring complete privacy and security
  • Zero Network Dependency: Works offline without internet connection

Core Functions

1. Image Watermarking

Text Watermark

  • Add Text Watermark: Add customizable text watermarks to images
  • Multiple Positions: Center, corners, or full-screen tiling
  • Custom Opacity: Adjust watermark transparency (0-255)
  • Color Options: Choose from 5 predefined colors (Gray, Red, Green, Blue, Yellow)
  • Font Size Control: Adjust text size to meet your needs
  • Chinese Font Support: Built-in Chinese font to prevent character encoding issues

Icon Watermark

  • Add Icon Watermark: Add icon or logo watermarks to images
  • Multiple Input Methods: Upload icon file or provide icon URL
  • Flexible Positioning: Center, top-left, or bottom-right placement
  • Scale Control: Adjust icon size as a percentage of base image width (1-100%)
  • Opacity Adjustment: Fine-tune watermark transparency (0-255)

2. Image Resizing

Image Resize Crop (object-fit: cover)

  • Crop Strategy: Resize image using crop strategy (similar to object-fit: cover)
  • Fill Target Dimensions: Image will fill the target dimensions, excess will be cropped
  • Preset Sizes: Standard photo sizes based on 300 DPI (1 inch, large 1 inch, 2 inch, small 2 inch)
  • Custom Dimensions: Specify custom width and height in pixels
  • High Quality: Uses LANCZOS resampling for best quality

Image Resize Pad (object-fit: contain)

  • Pad Strategy: Resize image using pad strategy (similar to object-fit: contain)
  • Preserve Original: Original image will be fully displayed
  • Background Color: Fill excess area with customizable background color
  • Preset Sizes: Standard photo sizes based on 300 DPI (1 inch, large 1 inch, 2 inch, small 2 inch)
  • Custom Dimensions: Specify custom width and height in pixels
  • High Quality: Uses LANCZOS resampling for best quality

3. Image Compression

Compress images to reduce file size while maintaining acceptable quality.

  • Quality Control: Adjust compression quality (1-100)
  • Format-Specific Strategies:
    • JPG/JPEG/WEBP: Lossy compression with quality parameter
    • PNG: Lossless optimization (quality >= 90) or palette quantization (quality < 90)
    • SVG/GIF/ICO: Skip compression with notification
  • Size Reduction: Reduce file size while maintaining acceptable quality

4. Image Format Conversion

Supports conversion between multiple image formats:

  • PNG: Convert to PNG format, preserves transparency
  • JPG/JPEG: Convert to JPG/JPEG format, transparency handled by compositing over white background
  • WEBP: Convert to WEBP format, preserves transparency
  • BMP: Convert to BMP format
  • TIFF: Convert to TIFF format
  • GIF: Convert to GIF format
  • ICO: Convert to ICO format
  • SVG: Convert to SVG format

Technical Advantages

  • Local Processing: All image processing is executed locally without external dependencies
  • High Quality Output: Maintains original image quality while processing
  • Flexible Options: Various configuration options for different use cases
  • Error Handling: Robust error handling with informative messages
  • Secure Processing: Images are processed securely without data retention
  • Chinese Font Support: Prevents Chinese character encoding issues

Requirements

  • Python 3.12
  • Dify platform access
  • Required Python packages (install via requirements.txt)

Installation & Configuration

  1. Install required dependencies:

    pip install -r requirements.txt
  2. Install the plugin in your Dify environment following the standard plugin installation process

Usage

The plugin provides the following tools:

1. Image Compress (image_compress)

Compress images to reduce file size.

  • Parameters:
    • image_file: The original image file to compress (required)
    • quality: Compression quality (optional, default: 80, range: 1-100)
  • Features:
    • Format-specific compression strategies
    • JPG/JPEG/WEBP: Lossy compression with quality parameter
    • PNG: Lossless optimization (quality >= 90) or palette quantization (quality < 90)
    • SVG/GIF/ICO: Skip compression with notification
    • Displays input/output format and file size

2. Add Text Watermark (add_text_watermark)

Add customizable text watermarks to images.

  • Parameters:
    • image_file: The original image file to add watermark (required)
    • text: The text content of the watermark (required)
    • position: The position of the watermark (optional, default: tile)
      • center: Image center
      • corners: Four corners
      • br: Bottom right
      • bl: Bottom left
      • tr: Top right
      • tl: Top left
      • tile: Full-screen tiling (default)
    • opacity: The opacity of the watermark (optional, default: 40, range: 0-255)
    • color: The color of the watermark (optional, default: #808080)
      • Gray: #808080
      • Red: #FF0000
      • Green: #00FF00
      • Blue: #0000FF
      • Yellow: #FFFF00
    • font_size: The font size of the watermark (optional, default: 30, range: 1+)
  • Features:
    • Supports Chinese text with built-in Chinese font
    • Tiling mode with rotation for full-screen watermark
    • Multiple positioning options
    • Adjustable opacity and color

3. Add Icon Watermark (add_icon_watermark)

Add icon or logo watermarks to images.

  • Parameters:
    • image_file: The base image file to add watermark (required)
    • icon_file: The logo image file for watermark (optional, recommended: png or jpg)
    • icon_url: The URL of the logo image for watermark (optional)
    • scale: The scale of the logo (percentage of base image width) (optional, default: 20, range: 1-100)
    • position: The position of the watermark (optional, default: bottom_right)
      • center: Image center
      • top_left: Top left corner
      • bottom_right: Bottom right corner (default)
    • opacity: The opacity of the watermark (optional, default: 200, range: 0-255)
  • Features:
    • Supports both file upload and URL input
    • Flexible scaling based on image width
    • Multiple positioning options
    • Maintains icon transparency

4. Image Resize Crop (image_resize_crop)

Resize image using crop strategy (object-fit: cover).

  • Parameters:
    • image_file: The original image file to resize (required)
    • preset_size: Standard photo sizes based on 300 DPI (optional, default: none)
      • none: No preset
      • 1_inch: 1 inch (25mm x 35mm) - 295x413 pixels
      • 1_inch_large: Large 1 inch (33mm x 48mm) - 390x567 pixels
      • 2_inch: 2 inch (35mm x 49mm) - 413x579 pixels
      • 2_inch_small: Small 2 inch (35mm x 45mm) - 413x531 pixels
    • custom_width: Custom width in pixels (required when preset_size is none)
    • custom_height: Custom height in pixels (required when preset_size is none)
  • Features:
    • Image fills target dimensions completely
    • Excess areas are cropped
    • High-quality LANCZOS resampling
    • Standard photo size presets

5. Image Resize Pad (image_resize_pad)

Resize image using pad strategy (object-fit: contain).

  • Parameters:
    • image_file: The original image file to resize (required)
    • preset_size: Standard photo sizes based on 300 DPI (optional, default: none)
      • none: No preset
      • 1_inch: 1 inch (25mm x 35mm) - 295x413 pixels
      • 1_inch_large: Large 1 inch (33mm x 48mm) - 390x567 pixels
      • 2_inch: 2 inch (35mm x 49mm) - 413x579 pixels
      • 2_inch_small: Small 2 inch (35mm x 45mm) - 413x531 pixels
    • custom_width: Custom width in pixels (required when preset_size is none)
    • custom_height: Custom height in pixels (required when preset_size is none)
    • pad_color: Background color for padding (optional, default: #FFFFFF)
  • Features:
    • Original image fully displayed
    • Excess areas filled with background color
    • High-quality LANCZOS resampling
    • Standard photo size presets
    • Customizable padding color

6. Convert to JPG (convert_to_jpg)

Convert image to JPG format (.jpg extension).

  • Parameters:
    • image_file: The original image file to convert (required)
  • Features:
    • Outputs .jpg extension file
    • Transparency handled by compositing over white background
    • Displays input/output format and file size

7. Convert to JPEG (convert_to_jpeg)

Convert image to JPEG format (.jpeg extension).

  • Parameters:
    • image_file: The original image file to convert (required)
  • Features:
    • Outputs .jpeg extension file
    • Transparency handled by compositing over white background
    • Displays input/output format and file size

8. Convert to BMP (convert_to_bmp)

Convert image to BMP format.

  • Parameters:
    • image_file: The original image file to convert (required)
  • Features:
    • Uncompressed format
    • Widely compatible

9. Convert to PNG (convert_to_png)

Convert image to PNG format.

  • Parameters:
    • image_file: The original image file to convert (required)
  • Features:
    • Preserves transparency
    • Lossless compression

10. Convert to WEBP (convert_to_webp)

Convert image to WEBP format.

  • Parameters:
    • image_file: The original image file to convert (required)
  • Features:
    • Preserves transparency
    • Modern format with excellent compression

11. Convert to TIFF (convert_to_tiff)

Convert image to TIFF format.

  • Parameters:
    • image_file: The original image file to convert (required)
  • Features:
    • Lossless compression
    • Professional format

12. Convert to GIF (convert_to_gif)

Convert image to GIF format.

  • Parameters:
    • image_file: The original image file to convert (required)
  • Features:
    • Animated support
    • Web-friendly format

13. Convert to ICO (convert_to_ico)

Convert image to ICO format.

  • Parameters:
    • image_file: The original image file to convert (required)
  • Features:
    • Icon format for Windows
    • Multiple sizes support

14. Convert to SVG (convert_to_svg)

Convert image to SVG format.

  • Parameters:
    • image_file: The original image file to convert (required)
  • Features:
    • Scalable vector format
    • Web-friendly format

Notes

  • All image processing is executed locally without uploading images to external services
  • The plugin includes Chinese fonts to prevent character encoding issues
  • For text watermarks, tiling mode rotates text by -30 degrees for better coverage
  • For icon watermarks, either icon_file or icon_url must be provided
  • Large images may require longer processing time depending on their size and complexity
  • Output image quality depends on the quality of the input image

Developer Information

  • Author: https://github.com/sawyer-shi
  • Email: [email protected]
  • License: Apache License 2.0
  • Source Code: https://github.com/sawyer-shi/dify-plugins-image_toolbox
  • Support: Available through Dify platform and GitHub Issues

License Statement

This project is licensed under the Apache License 2.0. The full license text is available in the LICENSE file.


Ready to process your images?

Plugin Submission Form

1. Metadata

  • Plugin Author:
  • Plugin Name:
  • Repository URL:

2. Submission Type

  • New plugin submission
  • Version update for existing plugin

3. Description

4. Checklist

  • I have read and followed the Publish to Dify Marketplace guidelines
  • I have read and comply with the Plugin Developer Agreement
  • I confirm my plugin works properly on both Dify Community Edition and Cloud Version
  • I confirm my plugin has been thoroughly tested for completeness and functionality
  • My plugin brings new value to Dify

5. Documentation Checklist

Please confirm that your plugin README includes all necessary information:

  • Step-by-step setup instructions
  • Detailed usage instructions
  • All required APIs and credentials are clearly listed
  • Connection requirements and configuration details
  • Link to the repository for the plugin source code

6. Privacy Protection Information

Based on Dify Plugin Privacy Protection Guidelines:

Data Collection

Privacy Policy

  • I confirm that I have prepared and included a privacy policy in my plugin package based on the Plugin Privacy Protection Guidelines

…ression, adding watermarks (text and icon watermarks), adjusting image dimensions (cropping and expanding images), and converting image formats (jpg, png, webp, bmp, tiff, gif, ico, svg).】
…ression, adding watermarks (text and icon watermarks), adjusting image dimensions (cropping and expanding images), and converting image formats (jpg, png, webp, bmp, tiff, gif, ico, svg).】
@crazywoola crazywoola merged commit cf6d247 into langgenius:main Jan 7, 2026
1 check passed
@sawyer-shi sawyer-shi deleted the main-image_toolbox-0.0.1.difypkg branch January 7, 2026 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants