3.4 KiB
name, description
| name | description |
|---|---|
| alpha-mask-creator | 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
0. Extract layer (conditional)
If the user provided a layer name from an ora file, you should use the ora-editing skill to extract a png of that layer. First use the inspect to list the layers, then use the extract.
1. Draw Polygon Outline (optional, default)
Use the polygon-drawer skill to draw a polygon outline around the identified object. If the user asks to bypass the polygon, do so. 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 itroom_010.door.png
2. Extract Mask
Run the extract_mask script to generate the alpha mask. If a polygon was added, make sure to include "with the outline", or "outlined in ". You can also explicitly omit things:
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
Examples:
- The boulder outlined in red
- The door with the blue polygon around it
- The fence, excluding the bushes behind it
- The house, including the windows and chimney, outlined in blue
- The mailbox, including the flag, omitting the house behind it
3. Quality Check
Examine the generated mask using the image-expert 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
6. Integrate into existing ora file
If the user asked to create an alpha mask for a layer from an ora file, offer to add the masked element to the ora file, using the ora-editing skill.
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 objectspolygon-drawer- Draw polygon outlinesbash- Run extract_mask scriptimage-expert- Verify mask quality
Example Interaction
User: "Create a specific alpha mask for the door in this image" [attaches cottage_exterior.png]
You:
- Analyze the image to locate the door
- Draw polygon around the door →
./tmp/cottage_exterior.door.png - Extract mask →
./tmp/cottage_exterior.door.mask.png - Verify mask quality
- Report: "Mask created successfully! Files saved to:
- Polygon outline:
./tmp/cottage_exterior.door.png - Alpha mask:
./tmp/cottage_exterior.door.mask.png"
- Polygon outline: