This commit is contained in:
2026-03-09 09:22:21 -07:00
parent 8cfae8dea2
commit dd4899b8f9
29 changed files with 1014 additions and 1 deletions

View File

@@ -0,0 +1,65 @@
---
name: alpha-mask-creator
description: Takes an image and creates a high quality alpha mask of the requested entity. Typically invoked when the user asks to "create a specific alpha mask for"
---
# Alpha Mask Creator
This skill creates alpha masks from images based on user requests. Use this when the user asks to "create a specific alpha mask for..." along with providing an image.
## Workflow
### 1. Draw Polygon Outline
Use the `polygon-drawer` skill to draw a polygon outline around the identified object. Save the output to `./tmp/` with a sensible filename:
- Format: `<original_name>.<object>.png`
- Example: If the user wants a door mask from `room_010.png`, name it `room_010.door.png`
### 2. Extract Mask
Run the `extract_mask` script to generate the alpha mask:
```bash
source ./tools/venv/bin/activate
python tools/extract_mask.py "the door with the red outline" ./tmp/<original_name>.<object>.png ./tmp/<original_name>.<object>.mask.png
```
### 3. Quality Check
Examine the generated mask using the `image-inspector` agent:
- Check if the mask is precise and accurate
- Verify the object is properly isolated
- Ensure no artifacts or incorrect areas
**If the mask quality is poor:**
- Retry the polygon-drawer step with different parameters or seed
- Iterate until the mask is satisfactory
### 5. Report Results
Tell the user:
- Location of the polygon outline image: `./tmp/<original_name>.<object>.png`
- Location of the mask: `./tmp/<original_name>.<object>.mask.png`
- Confirm the mask quality is acceptable
## Naming Conventions
| User Request | Original File | Output Files |
|--------------|---------------|--------------|
| Door | `room_010.png` | `room_010.door.png`, `room_010.door.mask.png` |
| Tree | `forest_bg.png` | `forest_bg.tree.png`, `forest_bg.tree.mask.png` |
| Character | `scene_005.png` | `scene_005.character.png`, `scene_005.character.mask.png` |
## Tools Used
- `image-inspector` - Analyze images to locate objects
- `polygon-drawer` - Draw polygon outlines
- `bash` - Run extract_mask script
- `image-expert` - Verify mask quality
## Example Interaction
**User:** "Create a specific alpha mask for the door in this image" [attaches `cottage_exterior.png`]
**You:**
1. Analyze the image to locate the door
2. Draw polygon around the door → `./tmp/cottage_exterior.door.png`
3. Extract mask → `./tmp/cottage_exterior.door.mask.png`
4. Verify mask quality
5. Report: "Mask created successfully! Files saved to:
- Polygon outline: `./tmp/cottage_exterior.door.png`
- Alpha mask: `./tmp/cottage_exterior.door.mask.png`"