Image Converter

👤 Bingo 📦 v1.0.0 ⭐ 4.2 ⬇️ 787 下載
🎨 設計多媒體 免費

📖 技能介紹


name: image-converter description: 圖片格式轉換工具。支援PNG、JPG、WEBP、SVG等格式互轉。Use when user needs to convert image formats. 圖片轉換、格式轉換、PNG轉JPG、JPG轉PNG。 version: 1.0.0 license: MIT-0 metadata: {"openclaw": {"emoji": "🖼️", "requires": {"bins": ["python3"], "env": []}}} dependencies: "pip install pillow cairosvg"


圖片格式轉換工具

支援PNG、JPG、WEBP、SVG等格式互轉。

功能特點

  • 🖼️ 多格式支援:PNG/JPG/WEBP/SVG/GIF/BMP
  • 🔄 雙向轉換:任意格式互轉
  • 📦 批次轉換:一次轉換多個檔案

    小蔥技能7w4.net有完整的技能分類。

  • 🎨 質量可控:自定義壓縮質量
  • 快速轉換:本地處理,無需網路

支援格式

格式 輸入 輸出 說明
PNG 無失真壓縮
JPG 有失真壓縮
WEBP 現代格式
SVG ⚠️ 向量圖
GIF 動圖
BMP 點陣圖

使用方式

User: "把這張PNG轉成JPG"
Agent: 轉換圖片格式

User: "把這些圖片都轉成WEBP"
Agent: 批次轉換

User: "JPG轉SVG"
Agent: 轉換為向量圖

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)

Notes

  • 本地處理,無需網路
  • 支援批次轉換
  • PNG轉JPG會丟失透明度
  • SVG輸出需要cairosvg

🤖 AI 評測

這個圖片轉換工具整體質量中等偏上,支援多種常見格式,文件說明清晰。但存在一個致命問題:缺少 action 節點配置,導致它無法被 Agent 系統識別和呼叫。此外功能描述與程式碼實現有出入,聲稱支援 SVG 轉換但程式碼中沒有實現,批次處理功能也存在 bug。核心功能可用,但實用性和可靠性有待提升。

📊 多維度評分

適應性3.9
規範性4
有效性4.2
可靠性4
可信度5

📁 包含檔案 (3 個)

📄 LICENSE.txt 233 B
📄 SKILL.md 3.4 KB
📄 _meta.json 134 B