name: image-studio displayName: "Image Studio — 批次影像處理" allowed-tools: Bash(python *) description: > Batch image processing tool supporting remove background (摳圖), replace background (換背景), add watermark (水印), and resize/crop (尺寸裁剪). Processes single images or entire directories in batch mode. Supported formats: PNG, JPG, JPEG, WEBP, BMP, TIFF. Uses a local Python CLI (image_studio.py) backed by rembg + Pillow — no API keys or network required after dependency install. triggers: image-studio, 摳圖, 換背景, 水印, 裁剪, remove background, replace background, watermark, resize image, batch image processing homepage: "" license: MIT
A local CLI tool for batch image processing. All operations run offline on your machine using Python — no cloud API, no data leaves your computer.
Quick links: remove-bg · replace-bg · watermark · resize
The Python CLI lives at:
~/.agents/skills/image-studio/image_studio.py
All commands use python <path>/image_studio.py <command> ....
# Install the one external dependency
python ~/.agents/skills/image-studio/image_studio.py install
Or manually:
pip install rembg
rembg is only needed for remove-bg and replace-bg. The other commands (watermark, resize, info) work with just Pillow (pre-installed).
remove-bgRemove background from image(s). Uses AI-based rembg (u2net model).
# Single image
python ~/.agents/skills/image-studio/image_studio.py remove-bg \
-i input.jpg \
-o ./output
# Batch — entire directory
python ~/.agents/skills/image-studio/image_studio.py remove-bg \
-i ./images/ \
-o ./output_nobg
# Chinese alias
python ~/.agents/skills/image-studio/image_studio.py 摳圖 \
-i photo.jpg \
-o ./output
| Flag | Description | Default |
|---|---|---|
-i / --inputs |
Input file(s) or directory (required) | — |
-o / --output-dir |
Output directory | ./output_nobg |
--model |
rembg model name (u2net, u2netp, u2net_human_seg, etc.) |
u2net |
Fallback: If rembg is not installed, the skill falls back to OpenCV GrabCut (less accurate but dependency-free).
replace-bgRemove background and composite the subject onto a new background (image or solid color).
# Replace with image
python ~/.agents/skills/image-studio/image_studio.py replace-bg \
-i portrait.jpg \
-b beach_background.jpg \
-o ./output
# Replace with solid color
python ~/.agents/skills/image-studio/image_studio.py replace-bg \
-i product.jpg \
--bg-color "#3498db" \
-o ./output
# Batch replace
python ~/.agents/skills/image-studio/image_studio.py replace-bg \
-i ./photos/ \
-b studio_bg.jpg \
-o ./output_newbg
| Flag | Description | Default |
|---|---|---|
-i / --inputs |
Input file(s) or directory (required) | — |
-b / --background |
Background image path | — |
--bg-color |
Solid background color (hex) | #ffffff |
-o / --output-dir |
Output directory | ./output_newbg |
-b and --bg-color are mutually exclusive.
watermarkAdd text or image watermark with configurable position, opacity, and size.
# Text watermark
python ~/.agents/skills/image-studio/image_studio.py watermark \
-i photo.jpg \
-t "© 2024 Your Name" \
-p bottom-right \
--opacity 0.6 \
--font-size 48 \
--font-color "#ffffff" \
-o ./output
# Image watermark (logo)
python ~/.agents/skills/image-studio/image_studio.py watermark \
-i photo.jpg \
--image logo.png \
--scale 0.15 \
-p bottom-right \
--opacity 0.8 \
-o ./output
# Tiled watermark (full coverage)
python ~/.agents/skills/image-studio/image_studio.py watermark \
-i document.jpg \
-t "DRAFT" \
-p tile \
--opacity 0.3 \
-o ./output
# Batch watermark
python ~/.agents/skills/image-studio/image_studio.py watermark \
-i ./photos/ \
-t "© 2024" \
-p bottom-right \
-o ./output_wm
| Flag | Description | Default |
|---|---|---|
-i / --inputs |
Input file(s) or directory (required) | — |
-t / --text |
Watermark text | — |
--image |
Watermark image path | — |
-p / --position |
top-left, top, top-right, left, center, right, bottom-left, bottom, bottom-right, tile |
bottom-right |
--opacity |
Opacity 0 (transparent) – 1 (solid) | 0.5 |
--font-size |
Font size in px (text only) | 36 |
--font-color |
Font hex color (text only) | #ffffff |
--scale |
Watermark size ratio 0–1 relative to image width (image only) | 0.1 |
-t and --image are mutually exclusive.
resizeResize or crop image(s) to target dimensions. Four modes:
| Mode | Description |
|---|---|
resize |
Stretch to exact dimensions (may distort) |
cover |
Fill target entirely, crop overflow (like CSS object-fit: cover) |
contain |
Fit inside target with letterbox bars (like CSS object-fit: contain) |
crop |
Center-crop to target aspect ratio, then resize |
# Cover mode (default) — best for thumbnails/banners
python ~/.agents/skills/image-studio/image_studio.py resize \
-i photo.jpg \
-w 1920 -h 1080 \
--mode cover \
-o ./output
# Contain mode — with letterbox bg
python ~/.agents/skills/image-studio/image_studio.py resize \
-i photo.jpg \
-w 800 -h 800 \
--mode contain \
--bg-color "#000000" \
-o ./output
# Crop mode — center crop to ratio
python ~/.agents/skills/image-studio/image_studio.py resize \
-i photo.jpg \
-w 1080 -h 1080 \
--mode crop \
-o ./output
# Batch resize all images in a folder
python ~/.agents/skills/image-studio/image_studio.py resize \
-i ./images/ \
-w 800 -h 600 \
--mode cover \
-o ./output_resize
| Flag | Description | Default |
|---|---|---|
-i / --inputs |
Input file(s) or directory (required) | — |
-w / --width |
Target width in px (required) | — |
-h / --height |
Target height in px (required) | — |
--mode |
resize | cover | contain | crop |
cover |
--bg-color |
Letterbox color (contain mode only) | #000000 |
--format |
Output format: png or jpg |
png |
infoShow image metadata (dimensions, mode, file size).
python ~/.agents/skills/image-studio/image_studio.py info \
-i photo.jpg
python ~/.agents/skills/image-studio/image_studio.py info \
-i ./images/
All commands accept directories as -i input. They scan for supported formats: .png, .jpg, .jpeg, .webp, .bmp, .tiff.
Pipeline: batch remove background → replace → resize → watermark
SKILL=~/.agents/skills/image-studio/image_studio.py
DIR=./batch
# Step 1: Remove backgrounds
python $SKILL remove-bg -i $DIR/photos -o $DIR/step1_nobg
# Step 2: Replace with new background
python $SKILL replace-bg -i $DIR/step1_nobg -b bg.jpg -o $DIR/step2_newbg
# Step 3: Resize to uniform size
python $SKILL resize -i $DIR/step2_newbg -w 1920 -h 1080 --mode cover -o $DIR/step3_resize
# Step 4: Add watermark
python $SKILL watermark -i $DIR/step3_resize -t "© 2024" -p bottom-right -o $DIR/final
| Scenario | Behavior |
|---|---|
| No supported files found | Exit with "No supported image files found." message |
rembg not installed for remove-bg/replace-bg |
Auto-fallback to OpenCV GrabCut (less accurate) |
| Invalid hex color | Falls back to white |
| Unknown position | Warns and uses bottom-right |
| Directory doesn't exist | Created automatically for -o; errors for -i |
| Unsupported format | Skipped silently (only supported extensions are processed) |
python ~/.agents/skills/image-studio/image_studio.py installpython ~/.agents/skills/image-studio/image_studio.py info -i any_image.jpg小蔥技能站7w4.net每天更新,海量AI技能等你發現。
The user activates this skill by typing /image-studio or any trigger keyword. When invoked:
rembg is available if the task involves background removal. If not, suggest running pip install rembg or the install sub-command.python image_studio.py ... command.All output preserves RGBA transparency where applicable. PNG is the default output format for transparency support.
這是一個功能豐富、質量較高的影像處理 Skill,核心功能齊全且支援批次操作,離線執行無需網路。文件清晰易懂,中文命令對國內使用者友好。rembg 缺失時能自動降級保證了可用性。主要不足是缺少測試和示例檔案,且水印功能在某些環境下可能無法正確顯示中文。總體而言是個好用的工具,適合需要批次處理圖片的使用者。