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`"

View File

@@ -0,0 +1,67 @@
# Polygon Drawer Skill
This skill uses @tools/draw_polygon.py to draw polygons on any image. It's useful for highlighting areas, marking objects, creating masks, or annotating images with colored shapes.
## Usage Examples
### Draw a red box around an object
```
Draw a red box around the door in image.png
# Executes: python tools/draw_polygon.py tmp/annotated_image.png "0.3,0.2 0.7,0.2 0.7,0.8 0.3,0.8" --color red --save tmp/annotated_image.png
# Opens: /home/noti/dev/ai-game-2/tmp/annotated_image.png
```
### Highlight an area in green
```
Highlight the pool in green using a polygon
# Executes: python tools/draw_polygon.py tmp/pool_highlight.png "0.2,0.5 0.8,0.5 0.8,0.9 0.2,0.9" --color green --fill --save tmp/pool_highlight.png
# Opens: /home/noti/dev/ai-game-2/tmp/pool_highlight.png
```
### Draw a blue circle (approximated with polygon)
```
Draw a blue circle around the tree
# Executes: python tools/draw_polygon.py tmp/tree_circle.png "0.4,0.3 0.6,0.3 0.6,0.5 0.4,0.5" --color blue --save tmp/tree_circle.png
# Opens: /home/noti/dev/ai-game-2/tmp/tree_circle.png
```
### Fill a region with semi-transparent overlay
```
Fill the sky area with semi-transparent yellow
# Executes: python tools/draw_polygon.py tmp/sky_overlay.png "0,0 1,0 1,0.6 0,0.6" --color yellow --fill --save tmp/sky_overlay.png
# Opens: /home/noti/dev/ai-game-2/tmp/sky_overlay.png
```
### Mark a specific point with a small polygon
```
Mark the character location with a red polygon
# Executes: python tools/draw_polygon.py tmp/character_mark.png "0.5,0.4 0.52,0.38 0.54,0.4 0.52,0.42" --color red --save tmp/character_mark.png
# Opens: /home/noti/dev/ai-game-2/tmp/character_mark.png
```
## How It Works
1. **Analyze** the image to understand what needs highlighting
2. **Extract** polygon coordinates based on visual patterns or user input
3. **Execute** the draw_polygon.py script with percentage coordinates (0.0-1.0)
4. **Save** the result to ./tmp/ and display the file path
5. **Open** the output for you to view
## Coordinate System
Coordinates use **percentage mode** (0.0-1.0) by default:
- `0.0,0.0` = top-left corner
- `1.0,1.0` = bottom-right corner
- `0.5,0.5` = center of image
## Common Use Cases
- Highlighting objects or regions of interest
- Creating masks for image processing
- Marking locations for documentation
- Annotating images with colored boundaries
- Visualizing spatial relationships
## Output
All annotated images are saved to `./tmp/` and the full path is displayed so you can open them in your image viewer.

View File

@@ -0,0 +1,79 @@
---
name: polygon-drawer
description: Takes an image and adds a polygon to it at the user's request. Typically the user will ask to add a polygon around a particular object
---
# Polygon Drawer Skill
This skill uses @tools/draw_polygon.py to help you draw polygons on any image. It's useful for highlighting areas, drawing boxes, marking regions, or annotating images with colored shapes.
## Usage Examples
### Draw a red box around an object
```
Draw a red box around the door in <image>
```
### Highlight a specific area in green
```
Highlight the pool area in <image> with a green polygon
```
### Draw a blue rectangle with percentage coordinates
```
Draw a blue polygon on <image> using coordinates: 0.5,0.3 0.7,0.3 0.7,0.6 0.5,0.6
```
### Mark a triangular region with fill
```
Draw a semi-transparent yellow triangle on <image>: 0.5,0.1 0.9,0.9 0.1,0.9 --fill
```
### Draw a custom-colored polygon with thick lines
```
Draw a cyan polygon on <image>: 0.2,0.2 0.8,0.2 0.8,0.8 0.2,0.8 --color cyan --thickness 5
```
### Use pixel coordinates (absolute mode)
```
Draw a red box using pixel coordinates: 100,50 400,50 400,300 100,300 --absolute
```
Make sure to quote the coordinates when calling the script: "100,50 400,50 400,300 100,300"
## How It Works
1. **Analyze** the image to identify what needs highlighting
2. **Calculate** polygon coordinates (default: percentage mode 0.0-1.0)
3. **Execute** `@tools/draw_polygon.py` with the calculated points
4. **Output** the resulting image to `./tmp/` directory
5. **Display** the save path so you can open it
## Coordinate Systems
- **Percentage mode** (default): 0.0-1.0 coordinates where (0,0) is top-left and (1,1) is bottom-right
- **Absolute mode**: Use `--absolute` flag for actual pixel coordinates
## Output Location
By default, the image is just shown to the user without writing anything.
If the user asks to save it, use the --save flag.
All generated images are saved to:
```
./tmp/
```
The skill will output the full path to the saved image, e.g., `./tmp/output_1234567890.png`
## Color Options
- Named colors: red, green, blue, yellow, cyan, magenta, white, black, orange, purple, brown, pink, gray, grey, lime, navy, teal, maroon
- Hex codes: #FF0000, #00FF00FF, etc.
## Flags
- `--fill`: Fill polygon with semi-transparent color
- `--absolute`: Use pixel coordinates instead of percentages
- `--color <name>`: Specify polygon color (default: red)
- `--thickness <pixels>`: Line thickness (default: 4)
- `--save <path>`: Override default save location (still goes to ./tmp/)