2.5 KiB
2.5 KiB
name, description
| name | description |
|---|---|
| polygon-drawer | 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
- Analyze the image to identify what needs highlighting
- Calculate polygon coordinates (default: percentage mode 0.0-1.0)
- Execute
@tools/draw_polygon.pywith the calculated points - Output the resulting image to
./tmp/directory - 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
--absoluteflag 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/)