Classic image manipulation with Python Pillow - resize, crop, composite, format conversion, watermarks, brightness/contrast adjustments, and web optimization...
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install image-utils或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install image-utils⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/image-utils/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: image-utils description: Classic image manipulation with Python Pillow - resize, crop, composite, format conversion, watermarks, brightness/contrast adjustments, and web optimization. Use this skill when post-processing AI-generated images, preparing images for web delivery, batch processing image directories, creating responsive image variants, or performing any deterministic pixel-level image operation. Works standalone or alongside bria-ai for post-processing generated images. license: MIT metadata: author: Bria AI version: "1.3.0" ---
Pillow-based utilities for deterministic pixel-level image operations. Use for resize, crop, composite, format conversion, watermarks, and other standard image processing tasks.
bria-ai InsteadThis skill handles deterministic pixel-level operations only. For any generative or AI-powered image work, use the bria-ai skill instead:
bria-aibria-aibria-aibria-aibria-aibria-aiRule of thumb: If the task requires creating new visual content or understanding image semantics, use bria-ai. If the task requires transforming existing pixels (resize, crop, format convert, watermark), use this skill.
If bria-ai is not available, install it with:
npx skills add bria-ai/bria-skill
| Operation | Method | Description | |-----------|--------|-------------| | Loading | load(source) | Load from URL, path, bytes, or base64 | | | load_from_url(url) | Download image from URL | | Saving | save(image, path) | Save with format auto-detection | | | to_bytes(image, format) | Convert to bytes | | | to_base64(image, format) | Convert to base64 string | | Resizing | resize(image, width, height) | Resize to exact dimensions | | | scale(image, factor) | Scale by factor (0.5 = half) | | | thumbnail(image, size) | Fit within size, maintain aspect | | Cropping | crop(image, left, top, right, bottom) | Crop to region | | | crop_center(image, width, height) | Crop from center | | | crop_to_aspect(image, ratio) | Crop to aspect ratio | | Compositing | paste(bg, fg, position) | Overlay at coordinates | | | composite(bg, fg, mask) | Alpha composite | | | fit_to_canvas(image, w, h) | Fit onto canvas size | | Borders | add_border(image, width, color) | Add solid border | | | add_padding(image, padding) | Add whitespace padding | | Transforms | rotate(image, angle) | Rotate by degrees | | | flip_horizontal(image) | Mirror horizontally | | | flip_vertical(image) | Flip vertically | | Watermarks | add_text_watermark(image, text) | Add text overlay | | | add_image_watermark(image, logo) | Add logo watermark | | Adjustments | adjust_brightness(image, factor) | Lighten/darken | | | adjust_contrast(image, factor) | Adjust contrast | | | adjust_saturation(image, factor) | Adjust color saturation | | | blur(image, radius) | Apply Gaussian blur | | Web | optimize_for_web(image, max_size) | Optimize for delivery | | Info | get_info(image) | Get dimensions, format, mode |
pip install Pillow requests
from image_utils import ImageUtils
# Load from URL
image = ImageUtils.load_from_url("https://example.com/image.jpg")
# Or load from various sources
image = ImageUtils.load("/path/to/image.png") # File path
image = ImageUtils.load(image_bytes) # Bytes
image = ImageUtils.load("data:image/png;base64,...") # Base64
# Resize and save
resized = ImageUtils.resize(image, width=800, height=600)
ImageUtils.save(resized, "output.webp", quality=90)
# Get image info
info = ImageUtils.get_info(image)
print(f"{info['width']}x{info['height']} {info['mode']}")
# Resize to exact dimensions
resized = ImageUtils.resize(image, width=800, height=600)
# Resize maintaining aspect ratio (fit within bounds)
fitted = ImageUtils.resize(image, width=800, height=600, maintain_aspect=True)
# Resize by width only (height auto-calculated)
resized = ImageUtils.resize(image, width=800)
# Scale by factor
half = ImageUtils.scale(image, 0.5) # 50% size
double = ImageUtils.scale(image, 2.0) # 200% size
# Create thumbnail
thumb = ImageUtils.thumbnail(image, (150, 150))
# Crop to specific region
cropped = ImageUtils.crop(image, left=100, top=50, right=500, bottom=350)
# Crop from center
center = ImageUtils.crop_center(image, width=400, height=400)
# Crop to aspect ratio (for social media)
square = ImageUtils.crop_to_aspect(image, "1:1") # Instagram
wide = ImageUtils.crop_to_aspect(image, "16:9") # YouTube thumbnail
story = ImageUtils.crop_to_aspect(image, "9:16") # Stories/Reels
# Control crop anchor
top_crop = ImageUtils.crop_to_aspect(image, "16:9", anchor="top")
bottom_crop = ImageUtils.crop_to_aspect(image, "16:9", anchor="bottom")
# Paste foreground onto background
result = ImageUtils.paste(background, foreground, position=(100, 50))
# Alpha composite (foreground must have transparency)
result = ImageUtils.composite(background, foreground)
# Fit image onto canvas with letterboxing
canvas = ImageUtils.fit_to_canvas(
image,
width=1200,
height=800,
background_color=(255, 255, 255, 255), # White
position="center" # or "top", "bottom"
)
# Convert to different formats
png_bytes = ImageUtils.to_bytes(image, "PNG")
jpeg_bytes = ImageUtils.to_bytes(image, "JPEG", quality=85)
webp_bytes = ImageUtils.to_bytes(image, "WEBP", quality=90)
# Get base64 for data URLs
base64_str = ImageUtils.to_base64(image, "PNG")
data_url = ImageUtils.to_base64(image, "PNG", include_data_url=True)
# Returns: "data:image/png;base64,..."
# Save with format auto-detected from extension
ImageUtils.save(image, "output.png")
ImageUtils.save(image, "output.jpg", quality=85)
ImageUtils.save(image, "output.webp", quality=90)
# Text watermark
watermarked = ImageUtils.add_text_watermark(
image,
text="© 2024 My Company",
position="bottom-right", # bottom-left, top-right, top-left, center
font_size=24,
color=(255, 255, 255, 128), # Semi-transparent white
margin=20
)
# Logo/image watermark
logo = ImageUtils.load("logo.png")
watermarked = ImageUtils.add_image_watermark(
image,
watermark=logo,
position="bottom-right",
opacity=0.5,
scale=0.15, # 15% of image width
margin=20
)
# Brightness (1.0 = original, <1 darker, >1 lighter)
bright = ImageUtils.adjust_brightness(image, 1.3)
dark = ImageUtils.adjust_brightness(image, 0.7)
# Contrast (1.0 = original)
high_contrast = ImageUtils.adjust_contrast(image, 1.5)
# Saturation (0 = grayscale, 1.0 = original, >1 more vivid)
vivid = ImageUtils.adjust_saturation(image, 1.3)
grayscale = ImageUtils.adjust_saturation(image, 0)
# Sharpness
sharp = ImageUtils.adjust_sharpness(image, 2.0)
# Blur
blurred = ImageUtils.blur(image, radius=5)
...
安装 Image Utils 后,可以对 AI 说这些话来触发它
Help me get started with Image Utils
Explains what Image Utils does, walks through the setup, and runs a quick demo based on your current project
Use Image Utils to classic image manipulation with Python Pillow - resize, crop, compo...
Invokes Image Utils with the right parameters and returns the result directly in the conversation
What can I do with Image Utils in my marketing & growth workflow?
Lists the top use cases for Image Utils, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/image-utils/ 目录(个人级,所有项目可用),或 .claude/skills/image-utils/(项目级)。重启 AI 客户端后,用 /image-utils 主动调用,或让 AI 根据上下文自动发现并使用。
Image Utils 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Image Utils 可免费安装使用。请查阅仓库了解许可证信息。
Classic image manipulation with Python Pillow - resize, crop, composite, format conversion, watermarks, brightness/contrast adjustments, and web optimization...
Image Utils 属于「Marketing & Growth」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my marketing & growth tasks using Image Utils
Identifies repetitive steps in your workflow and sets up Image Utils to handle them automatically