算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
find-ui-element【设计与创意】Find UI elements (buttons, links, dropdowns, checkboxes, radio buttons, text inputs, etc.) in screenshots by visual inspection, bounding box drawing, and crop verification. Use for computer-use tasks, UI automation, and visual element location.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Locate any clickable or interactive UI element in a screenshot — buttons, links, dropdowns, checkboxes, radio buttons, text input areas, etc. Uses a vision-first approach:
As an expert in your assigned roles, you must announce your actions before performing them using the following format:
As a {Role}, I will {action description}
This communication pattern ensures transparency and allows for human-in-the-loop oversight at key decision points.
Follow these steps in order.
Retry policy:
MAX_TRIES = 4 total attempts (1 initial + up to 3 retries)Load the screenshot and note its dimensions. Then visually inspect the full image to estimate where the target element is.
core/bin/python -c "from PIL import Image; img = Image.open('INPUT_PATH'); print(f'Dimensions: {img.size[0]}x{img.size[1]}')"
Look at the full screenshot and estimate the bounding box (x1, y1, x2, y2) of the target element based on visual inspection. Use the image dimensions to guide your estimate.
Draw the bounding box, then crop around it to verify.
core/bin/python core/skills/system/find-ui-element/scripts/draw_bbox.py INPUT_PATH x1 y1 x2 y2 .skillpilot/temp/bbox-TIMESTAMP.png
core/bin/python core/skills/system/find-ui-element/scripts/verify_bbox.py INPUT_PATH x1 y1 x2 y2 .skillpilot/temp/verify-TIMESTAMP.png --padding 24
draw_bbox.py options: --color R G B (default: 255 0 0), --width N (default: 3)verify_bbox.py options: --padding N pixels of context (default: 40). Prefer a small padding first (for example 24) to make small targets easier to inspect.Visually inspect the verification crop. If the bbox correctly covers the target element, go to Step 5.
If the coordinates were wrong, retry by narrowing to nearby regions using a fixed grid around the last failed bbox. Principle: finding a small element is easier in a small area than in the full screen.
core/bin/python core/skills/system/find-ui-element/scripts/crop_nearby_grid.py INPUT_PATH LAST_X1 LAST_Y1 LAST_X2 LAST_Y2 .skillpilot/temp/crops-TIMESTAMP/ --grid N
Choose the crop fraction based on how far off you were:
| Retry try | Grid | Crop size | When to use |
|---|---|---|---|
| Retry 1 | --grid 2 | 4 regions in nearby window | Initial estimate clearly far off |
| Retry 2 | --grid 3 | 9 regions in nearby window | Estimate is in roughly correct neighborhood |
| Retry 3 | --grid 4 | 16 regions in nearby window | Need fine local search for a small target |
crop_nearby_grid.py...._x1_y1_x2_y2.png).(x1, y1, x2, y2) in full-image coordinates (directly from the crop filename offsets).2 -> 3 -> 4), up to MAX_TRIES.Fallback (optional, final attempt only):
core/bin/python core/skills/system/find-ui-element/scripts/crop_quadrants.py INPUT_PATH .skillpilot/temp/global-crops-TIMESTAMP/ --grid 2
MAX_TRIES.If verified, report confirmed coordinates:
(x1, y1, x2, y2) — bounding box(cx, cy) — center point (for click targets): cx = (x1+x2)//2, cy = (y1+y2)//2If not verified after MAX_TRIES, report:
status: not_foundreason: verification_failed_after_max_trieslast_attempt_bbox: (x1, y1, x2, y2) (optional)(x1, y1, x2, y2)(cx, cy)grid 2 -> 3 -> 4) instead of ad hoc searchingMAX_TRIES.skillpilot/temp/ with descriptive, timestamped names