progress
This commit is contained in:
79
.opencode/skills/polygon-drawer/SKILL.md
Normal file
79
.opencode/skills/polygon-drawer/SKILL.md
Normal 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/)
|
||||
Reference in New Issue
Block a user