/install image-convert-skill
Image Converter Skill
支持常见图像格式相互转换或保留原格式压缩的自动化工具,使用前请确保已安装 Pillow 库:
pip install Pillow
# 或使用uv
uv add Pillow
目标格式优先级 (Target Format Precedence)
--to-format标志(最高优先级)- 明确的输出文件扩展名
- 默认行为:
- 默认:目录转换且未明确指定格式时转换为 WebP
--compress模式:保留输入格式
快速开始 / Usage Examples
Basic Format Conversion
Convert PNG to JPEG:
python scripts/convert.py input.png output.jpg
Convert WebP to PNG:
python scripts/convert.py input.webp output.png
Convert all images in a directory to PNG:
python scripts/convert.py ./input_dir ./output_dir --to-format png
Explicit Format Specification
Convert JPEG to WebP even if output has .jpg extension:
python scripts/convert.py input.jpg output.jpg --to-format webp
Compression
Compress PNG with quality 75 (preserves format):
python scripts/convert.py input.png output.png --compress --compress-quality 75
Batch Processing (Multiple Files)
Process multiple files using comma-separated list, glob patterns, or wildcard:
# Comma-separated files
python scripts/convert.py "img1.png,img2.jpg,img3.webp" output_dir/ --to-format png
# Glob pattern
python scripts/convert.py "*.jpg" output_dir/ --to-format webp
# Multiple patterns
python scripts/convert.py "*.png,*.jpg" output_dir/ --to-format webp
# Parallel processing (4 threads)
python scripts/convert.py "*.jpg" output_dir/ --threads 4
# Verbose output
python scripts/convert.py "*.jpg" output_dir/ -v
WebP Conversion (Legacy Usage Still Works)
Convert JPEG to WebP with quality 85:
python scripts/convert.py input.jpg output.webp --quality 85
Convert directory to WebP (keeps original files):
python scripts/convert.py ./images/ ./webp_output/
Lossless compression:
python scripts/convert.py input.png output.webp --lossless
Scale image (longest edge 1920px):
python scripts/convert.py input.jpg output.webp --max-size 1920
Batch compress directory (preserves format):
python scripts/convert.py ./images/ ./compressed/ --compress
功能列表
| 功能 | 说明 |
|---|---|
| 相互转换 | 支持常见图像格式之间的相互转换 |
| 批量转换 | 支持目录、文件列表、逗号分隔、通配符输入 |
| 并行处理 | 多线程批量转换加速 |
| 质量控制 | 有损压缩质量 1-100 |
| 无损模式 | 保持原始像素质量 |
| 尺寸缩放 | 按最长边等比缩放 |
| 色彩空间 | 自动转换 CMYK→RGB,调色板→RGBA |
| 元数据 | 清除 EXIF,保留 ICC 配置文件 |
| 格式保留压缩 | 保留原格式进行压缩(PNG/JPEG/GIF/WebP/TIFF) |
CLI 参数
转换参数 (Conversion Options)
| 参数 | 说明 | 默认值 |
|---|---|---|
--to-format |
明确指定目标格式 (jpeg, png, webp, gif, bmp, tiff),优先级高于输出扩展名 | 无 |
--quality |
压缩质量 (1-100) | 90 |
--max-size |
最长边缩放像素 | 不缩放 |
--lossless |
启用无损压缩 | False |
压缩参数(保留原格式)
| 参数 | 说明 | 默认值 |
|---|---|---|
--compress |
启用压缩模式,保留原格式 | False |
--compress-quality |
压缩质量 (1-100) | 85 |
--compress-level |
PNG/TIFF 压缩级别 (0-9) | 6 |
批量处理参数
| 参数 | 说明 | 默认值 |
|---|---|---|
--threads |
并行处理线程数 | 1 |
--verbose, -v |
显示详细进度信息 | False |
参考
详细 WebP 参数配置请查看 webp_settings.md。
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install image-convert-skill - After installation, invoke the skill by name or use
/image-convert-skill - Provide required inputs per the skill's parameter spec and get structured output
What is Imgae Convert Skill?
使用 Pillow 支持常见图像格式(PNG、JPEG、GIF、BMP、TIFF、WebP)之间的相互转换和格式不变的压缩,支持质量控制、尺寸缩放和无损压缩模式。 It is an AI Agent Skill for Claude Code / OpenClaw, with 154 downloads so far.
How do I install Imgae Convert Skill?
Run "/install image-convert-skill" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Imgae Convert Skill free?
Yes, Imgae Convert Skill is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Imgae Convert Skill support?
Imgae Convert Skill is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Imgae Convert Skill?
It is built and maintained by LiuDeTao (@kanocifer); the current version is v0.1.2.