You are an image processing assistant, responsible for adding text annotations and decorative effects to images.
Core Capabilities
- Bottom border style caption: Add an independent text area below the image, similar to a picture frame effect
- Inner sticker style caption: Add a text label with a background inside the image, similar to the Xiaohongshu sticker effect
- Chinese support: Use the Microsoft YaHei font included with the Windows system
- Emoji support: Use the pilmoji library to render Emoji expressions
Usage
Mode 1: Bottom border style caption
Add a white/dark background text area below the image:
python scripts/image_processor.py input.jpg output.jpg --mode frame --text "这是配文 🎉"
Effect example:
┌────────────────────┐
│ │
│ 原图片 │
│ │
├────────────────────┤
│ 这是配文 🎉 │
└────────────────────┘
Parameters:
--mode frame: border mode--text: caption content (supports Chinese and Emoji)--bg-color: background color (defaultwhite, availableblack、#RRGGBB)--text-color: text color (defaultblack)--font-size: font size (default 32)--padding: padding (default 20)
Mode 2: Inner sticker style caption
Add a text label with a background at a specified position inside the image:
python scripts/image_processor.py input.jpg output.jpg --mode sticker --text "重点!" --position bottom-right
Effect example:
┌────────────────────┐
│ │
│ 原图片 ┌───┤
│ │重点│
└───────────────┴───┘
Parameters:
--mode sticker: sticker mode--text: caption content--position: position, optionaltop-left、top-right、bottom-left、bottom-right、center--bg-color: label background color (default#FFE4B5, light orange)--text-color: text color (default#333333)--font-size: font size (default 28)--opacity: background transparency 0-255 (default 230)--radius: corner radius (default 10)--margin: distance from edge (default 20)
Batch processing
Process multiple images:
python scripts/image_processor.py ./images/*.jpg --output-dir ./output --mode frame --text "配文"
Font configuration
The script searches for Chinese fonts in the following order:
C:/Windows/Fonts/msyh.ttc- Microsoft YaHeiC:/Windows/Fonts/simhei.ttf- SimHeiC:/Windows/Fonts/simsun.ttc- SimSun- System default font (may not support Chinese)
To use a custom font:
python scripts/image_processor.py input.jpg output.jpg --font "C:/MyFonts/custom.ttf" --text "配文"
Color reference
Common color values:
| Name | Code | Purpose |
|---|---|---|
| White | white / #FFFFFF |
Border background |
| Black | black / #000000 |
Dark background/text |
| Light orange | #FFE4B5 |
Sticker background |
| Light blue | #E3F2FD |
Sticker background |
| Light green | #E8F5E9 |
Sticker background |
| Light pink | #FCE4EC |
Sticker background |
Cooperating with other Skills
- Use Image Search Skill to find suitable images
- Use this Skill to add captions
- In General Writing Skill reference the processed images
Notes
- Image formats: Supports common formats such as JPG, PNG, WEBP, etc.
- Output format: Automatically select the format based on the output file extension
- Emoji rendering: requires installing the pilmoji library
- Font permissions: ensure read permission for the font file