🖼️ Image Converter — 图片格式转换

v1.0.0

本地图片格式互转工具,支持 PNG、JPG、WEBP、SVG、GIF、BMP 等常见格式批量转换,可自定义输出质量与尺寸,无需联网,基于 Pillow 与 CairoSVG 实现。

0· 115·1 当前·1 累计
tobewin 头像by @tobewin (ToBeWin)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/30
0
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
The skill's requirements and instructions match its stated purpose (local image format conversion); nothing requested is disproportionate or unrelated.
评估建议
This skill appears to do what it says: local image conversions using Python + Pillow and CairoSVG. Before using, consider: (1) only give it access to the specific files or directories you want converted — avoid pointing it at system or sensitive folders; (2) if the agent will pip-install dependencies, run that in a contained environment (virtualenv/container) if you have security concerns; (3) SVG-to-raster or raster-to-SVG conversions may change image fidelity and lose transparency (not a secur...
详细分析 ▾
用途与能力
名称/描述(图片格式转换)与需求一致:python3 二进制及 pillow、cairosvg 包适用于栅格/SVG 转换,未请求无关凭证、二进制或配置路径。
指令范围
SKILL.md 提供具体 Python 代码,用于在用户指定目录中打开、转换及批量处理文件——符合预期。注意:指令对代理提供的任意文件路径进行读写操作,这是转换工具的正常行为,但意味着代理需访问您要求转换的目录/文件;本技能未内置路径限制或显式 sanitization。
安装机制
本技能仅为指令型,无安装规范。元数据列出“pip install pillow cairosvg”,与声明功能相符且比例适当。这些为知名包,未使用外部下载 URL 或归档解压。
凭证需求
未请求环境变量、凭证或无关配置路径。访问范围仅限于图片文件 I/O,与声明用途匹配。
持久化与权限
技能非常驻启用,未请求提升或持久平台权限,也不修改其他技能或全局代理配置。
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/3/30

图片格式转换工具:支持PNG/JPG/WEBP/SVG/GIF/BMP互转,批量转换,质量可控

无害

安装命令

点击复制
官方npx clawhub@latest install image-converter
镜像加速npx clawhub@latest install image-converter --registry https://cn.longxiaskill.com

技能文档

# 图片格式转换工具 支持PNG、JPG、WEBP、SVG等格式互转。 ## 功能特点 - 🖼️ 多格式支持:PNG/JPG/WEBP/SVG/GIF/BMP - 🔄 双向转换:任意格式互转 - 📦 批量转换:一次转换多个文件 - 🎨 质量可控:自定义压缩质量 - ⚡ 快速转换:本地处理,无需网络 ## 支持格式 | 格式 | 输入 | 输出 | 说明 | |------|------|------|------| | PNG | ✅ | ✅ | 无损压缩 | | JPG | ✅ | ✅ | 有损压缩 | | WEBP | ✅ | ✅ | 现代格式 | | SVG | ⚠️ | ✅ | 矢量图 | | GIF | ✅ | ✅ | 动图 | | BMP | ✅ | ✅ | 位图 | ## 使用方式 `` User: "把这张PNG转成JPG" Agent: 转换图片格式 User: "把这些图片都转成WEBP" Agent: 批量转换 User: "JPG转SVG" Agent: 转换为矢量图 ` ## Python代码 `python from PIL import Image import os class ImageConverter: def __init__(self): self.formats = { 'png': 'PNG', 'jpg': 'JPEG', 'jpeg': 'JPEG', 'webp': 'WEBP', 'gif': 'GIF', 'bmp': 'BMP' } def convert(self, input_path, output_path, quality=95): """转换图片格式""" img = Image.open(input_path) # 获取输出格式 ext = os.path.splitext(output_path)[1].lower().replace('.', '') if ext in ['jpg', 'jpeg']: # JPG需要RGB if img.mode in ('RGBA', 'LA', 'P'): img = img.convert('RGB') img.save(output_path, 'JPEG', quality=quality) elif ext == 'png': img.save(output_path, 'PNG') elif ext == 'webp': img.save(output_path, 'WEBP', quality=quality) elif ext == 'gif': img.save(output_path, 'GIF') elif ext == 'bmp': img.save(output_path, 'BMP') else: img.save(output_path) return output_path def batch_convert(self, input_dir, output_dir, target_format='jpg', quality=95): """批量转换""" os.makedirs(output_dir, exist_ok=True) results = [] for filename in os.listdir(input_dir): if filename.lower().endswith(('.png', '.jpg', '.jpeg', '.webp', '.gif', '.bmp')): input_path = os.path.join(input_dir, filename) output_filename = os.path.splitext(filename)[0] + f'.{target_format}' output_path = os.path.join(output_dir, output_filename) try: self.convert(input_path, output_path, quality) results.append({'file': filename, 'status': 'success'}) except Exception as e: results.append({'file': filename, 'status': 'error', 'error': str(e)}) return results # 使用示例 converter = ImageConverter() converter.convert('input.png', 'output.jpg', quality=95) `` ## 注意事项 - 本地处理,无需网络 - 支持批量转换 - PNG转JPG会丢失透明度 - SVG输出需要cairosvg

数据来源ClawHub ↗ · 中文优化:龙虾技能库