Token导航 LogoToken导航TokenDH.com
图像处理权限需确认github未标认证来源可访问许可证需确认审计通过

image-converter图像转换器

Agent Skill

用于辅助图像生成、图片编辑、视觉素材处理或图像模型工作流。它适合让 Agent 根据文本生成图片、处理背景、整理视觉提示词或调用相关图像工具。使用时需要确认输入图片、版权来源、输出格式和模型限制;涉及人物、品牌、商品或公开展示素材时,应额外核对授权、真实性和内容合规边界。

总安装

188

周安装

8

GitHub Stars

公开资料未说明

下载量

66
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:image-converter(图像转换器)
来源仓库:https://github.com/horace4444/extend-my-claude-code
仓库路径:skills/image-converter
安装命令:
npx skills add https://github.com/horace4444/extend-my-claude-code --skill image-converter
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/horace4444/extend-my-claude-code --skill image-converter

简介

用于辅助图像生成、编辑或视觉素材处理工作流。

  • 适合根据文本生成图片、处理背景或调用图像工具。
  • 使用时需确认输入图片、版权来源及输出格式限制。
  • 支持 Codex、Claude、Cursor、Gemini CLI,安装方式为 github。
  • image-converter 属于图像处理类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Image Converter

Convert, resize, compress, and optimize images with Python Pillow.

Quick Start

from PIL import Image
import pillow_heif

# Register HEIF/HEIC support
pillow_heif.register_heif_opener()

img = Image.open("input.heic")
img.save("output.jpg", quality=85, optimize=True)

Dependencies

pip install pillow pillow-heif

Format Conversion

Supported Formats

FormatReadWriteNotes
JPEG/JPGYesYesLossy, best for photos
PNGYesYesLossless, supports transparency
WebPYesYesModern web format, excellent compression
HEIC/HEIFYesNo*Apple format, requires pillow-heif
GIFYesYesAnimation support
TIFFYesYesLossless, large files
BMPYesYesUncompressed
AVIFYesYes*Best compression, requires pillow-avif-plugin

*Limited support, check library versions

Mode Conversion

# RGBA (with alpha) -> RGB (for JPEG)
if img.mode in ('RGBA', 'LA', 'P'):
    img = img.convert('RGB')

# RGB -> Grayscale
gray = img.convert('L')

# Grayscale -> RGB
rgb = gray.convert('RGB')

Resizing & Downscaling

Proportional Resize

# Resize by percentage
scale = 0.5  # 50%
new_size = (int(img.width * scale), int(img.height * scale))
resized = img.resize(new_size, Image.LANCZOS)

# Resize to max dimension (preserve aspect ratio)
max_dim = 1920
ratio = min(max_dim / img.width, max_dim / img.height)
if ratio < 1:
    new_size = (int(img.width * ratio), int(img.height * ratio))
    resized = img.resize(new_size, Image.LANCZOS)

Thumbnail (in-place, efficient)

img.thumbnail((800, 800), Image.LANCZOS)  # Modifies in-place

Resampling Filters

  • Image.LANCZOS - Best quality, slower (recommended for downscaling)
  • Image.BICUBIC - Good quality, faster
  • Image.BILINEAR - Medium quality
  • Image.NEAREST - Fastest, pixelated (good for pixel art)

Compression & Optimization

JPEG Quality

# Quality 1-100 (80-85 is good balance)
img.save("out.jpg", quality=85, optimize=True)

# Progressive JPEG (loads gradually)
img.save("out.jpg", quality=85, optimize=True, progressive=True)

PNG Optimization

# Maximum compression
img.save("out.png", optimize=True, compress_level=9)

# Reduce colors for smaller file (256 colors max)
quantized = img.quantize(colors=256)
quantized.save("out.png", optimize=True)

WebP (best for web)

# Lossy (like JPEG)
img.save("out.webp", quality=85, method=6)

# Lossless (like PNG but smaller)
img.save("out.webp", lossless=True, quality=100)

Batch Processing

See scripts/batch_convert.py for full batch processing with:

  • Parallel processing with concurrent.futures
  • Progress reporting
  • Error handling
  • Multiple output formats

Basic Batch Pattern

from pathlib import Path
from concurrent.futures import ThreadPoolExecutor

def convert_image(path, output_dir, target_format, quality=85):
    img = Image.open(path)
    if img.mode != 'RGB':
        img = img.convert('RGB')
    output = output_dir / f"{path.stem}.{target_format}"
    img.save(output, quality=quality, optimize=True)
    return output

input_dir = Path("./images")
output_dir = Path("./converted")
output_dir.mkdir(exist_ok=True)

files = list(input_dir.glob("*.png"))
with ThreadPoolExecutor(max_workers=4) as executor:
    results = list(executor.map(
        lambda f: convert_image(f, output_dir, "jpg"),
        files
    ))

Metadata & EXIF

Strip All Metadata

# Create clean image (removes ALL metadata including ICC profile)
clean = Image.new(img.mode, img.size)
clean.putdata(list(img.getdata()))
clean.save("clean.jpg", quality=85)

Strip EXIF Only (preserve ICC color profile)

icc = img.info.get('icc_profile')
if 'exif' in img.info:
    del img.info['exif']
img.save("out.jpg", quality=85, icc_profile=icc)

Handle EXIF Orientation

from PIL import ImageOps
img = ImageOps.exif_transpose(img)  # Auto-rotate based on EXIF

Watermarking

from PIL import Image, ImageDraw, ImageFont

def add_watermark(img, text, opacity=128):
    watermark = Image.new('RGBA', img.size, (0, 0, 0, 0))
    draw = ImageDraw.Draw(watermark)

    # Use default font or specify path
    try:
        font = ImageFont.truetype("/System/Library/Fonts/Helvetica.ttc", 36)
    except:
        font = ImageFont.load_default()

    bbox = draw.textbbox((0, 0), text, font=font)
    text_width = bbox[2] - bbox[0]
    text_height = bbox[3] - bbox[1]

    x = img.width - text_width - 20
    y = img.height - text_height - 20

    draw.text((x, y), text, font=font, fill=(255, 255, 255, opacity))

    if img.mode != 'RGBA':
        img = img.convert('RGBA')

    return Image.alpha_composite(img, watermark)

Common Tasks

HEIC to JPEG (iPhone photos)

import pillow_heif
pillow_heif.register_heif_opener()

img = Image.open("photo.heic")
img = ImageOps.exif_transpose(img)  # Fix orientation
if img.mode != 'RGB':
    img = img.convert('RGB')
img.save("photo.jpg", quality=85, optimize=True)

Optimize for Web

def optimize_for_web(input_path, output_path, max_width=1920, quality=85):
    img = Image.open(input_path)
    img = ImageOps.exif_transpose(img)

    # Resize if too large
    if img.width > max_width:
        ratio = max_width / img.width
        new_size = (max_width, int(img.height * ratio))
        img = img.resize(new_size, Image.LANCZOS)

    # Convert mode
    if img.mode in ('RGBA', 'P'):
        img = img.convert('RGB')

    # Strip metadata
    icc = img.info.get('icc_profile')

    # Save optimized
    img.save(output_path, quality=quality, optimize=True,
             progressive=True, icc_profile=icc)

Create Thumbnails

def create_thumbnail(input_path, output_path, size=(300, 300)):
    img = Image.open(input_path)
    img = ImageOps.exif_transpose(img)
    img.thumbnail(size, Image.LANCZOS)

    if img.mode != 'RGB':
        img = img.convert('RGB')

    img.save(output_path, quality=85, optimize=True)

File Size Comparison

FormatTypical SizeBest For
JPEG 85%100% baselinePhotos
WebP 85%~30% smallerWeb images
PNG2-5x largerGraphics with transparency
AVIF 85%~50% smallerNext-gen web
HEIC~50% smallerApple ecosystem

Scripts

  • scripts/batch_convert.py - Full-featured batch converter with CLI
  • scripts/optimize_web.py - Web optimization with size targets

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.92%
按下载量换算26

Claude

27.34%
按下载量换算18

Cursor

17.95%
按下载量换算12

Gemini CLI

9.87%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

权限需确认

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills