image-annotations
它能做什么
这个技能可以在图片上添加箭头、方框和标注文字,帮助你突出截图或示意图中的重要部分。
适用场景
- ✓在截图中标出某个问题出现的位置时。
- ✓标明两张图片之间有哪些变化时。
- ✓给技术示意图添加标注时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/image-annotations/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“在这张截图中,给登录按钮加一个箭头,并写上文字“Login Button”。”
每周 5 个新技能,1 分钟读完。
工作原理
你提供图片并说明需要突出什么。这个技能会画出方框或箭头,并添加你指定的文字。它还会用特定颜色表示内容是好是坏。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Image Annotations
Add visual callouts to any image — screenshots, diagrams, architecture docs, demo frames — using PIL/Pillow. Highlights what changed or what to look at, so reviewers don't have to guess.
When to Use This Skill
Use this skill when you need to:
- Highlight a specific area in a screenshot for a PR description
- Annotate before/after images to show what changed
- Add labels and callouts to diagrams or architecture images
- Create annotated frames for animated GIF demos
Prerequisites
pip install Pillow -q
Color Rules
- Red (
#E63946) — only for "bad" / "removed" things (e.g., circling a bug being fixed) - Yellowish-orange (
#FF9F1C) — for neutral highlights ("look here", "new feature", etc.) - Never use red just because it's eye-catching — red = bad/removed
Font
- Use Ink Free (
C:/Windows/Fonts/Inkfree.ttf) for a handwritten look on Windows - On Linux/macOS, fall back to
ImageFont.load_default() - Size 36 for annotations on ~1400px-wide images
stroke_width=1withstroke_fill=<same color as fill>— gives body without being too thick- Do NOT use white stroke — looks like a bad glow effect
Shapes
- Prefer rounded rectangles over circles/ellipses — less pixelation at edges
draw.rounded_rectangle([x1, y1, x2, y2], radius=14, outline=color, width=5)- Padding 18px around the target content
Reference Snippet
from PIL import Image, ImageDraw, ImageFont
# Setup
font = ImageFont.truetype('C:/Windows/Fonts/Inkfree.ttf', 36) # or load_default()
color = '#FF9F1C' # orange for highlights
stroke = 5
pad = 18
img = Image.open('screenshot.png')
draw = ImageDraw.Draw(img)
# Rounded rect with padding
draw.rounded_rectangle(
[x1 - pad, y1 - pad, x2 + pad, y2 + pad],
radius=14, outline=color, width=stroke
)
# Leader line (same thickness as rect)
draw.line([x2 + pad, cy, x2 + pad + 40, cy - 30], fill=color, width=stroke)
# Label — same-color stroke for body, NO white stroke
draw.text(
(x2 + pad + 45, cy - 60), 'label text',
fill=color, font=font, stroke_width=1, stroke_fill=color
)
img.save('annotated.png')
Algorithmic Annotation — annotate.py
For images with multiple elements to annotate, use the annotate.py module below. Save it next to your script and import from it. It handles automatic label placement without overlapping.
Quick start
from annotate import annotate_image
result = annotate_image(
'screenshot.png',
[
{'elem': (560, 275, 635, 390), 'label': 'button', 'draw_box': True},
{'elem': (105, 453, 236, 470), 'label': 'status text'},
],
debug=True,
)
result.save('annotated.png')
elem:(x1, y1, x2, y2)tight bounding box — must be exact pixel coordinateslabel: text label (supports\nfor multi-line)draw_box: ifTrue, draws a rounded rectangle around the element. IfFalse(default), draws a V-arrowhead pointing at the elementdebug: shows targeting rectangles and candidate heatmap for placement validation
Coordinate grid helper
Always use grid_image() before annotating an unfamiliar image. Scaled-down previews display images smaller than actual pixel dimensions — the error compounds as you move away from (0,0).
from annotate import grid_image
grid = grid_image('screenshot.png', step=100)
grid.save('grid.png')
Then verify with small crops:
from PIL import Image
img = Image.open('screenshot.png')
crop = img.crop((x1 - 20, y1 - 20, x2 + 20, y2 + 20))
crop.save('verify.png')
Algorithm overview
- Ring search: candidates between MIN_ARROW (25px) and MAX_ARROW (120px) from element edge
- Contrast scoring: prefers placements where label text is readable —
abs(avg_brightness - 147) - std * 0.3 - dist * 0.02 - Joint resolution: candidates computed independently, placed greedily (best score first)
- Hard blocks: labels cannot overlap any other annotation's element or breathing box
- Proximity penalty: labels within 40px of other placed boxes get a score penalty
- Arrow crossing penalty: -50 for arrows crossing already-placed arrows
Debug mode colors
| Color | Meaning |
|---|---|
| Cyan | Target element box (elem + padding) |
| Gray | Exclusion zone (MIN_ARROW buffer) |
| Red→Green | Candidate heatmap (red=bad, green=good) |
| Magenta | Chosen label position |
| Orange | Final rendered annotation |
Arrow styles
…
常见问题
我可以使用任意颜色吗?
红色只用于表示不好的内容或被删除的部分。黄橙色则用于中性的高亮或新增功能。
工具怎么知道文字该放在哪里?
它会尽量找到最合适的位置,避免文字遮住重要区域,并通过算法防止文字之间相互重叠。
我需要先安装什么吗?
需要。你要先在 Python 环境中安装 Pillow 库。
详情
作者的原始描述
Annotate screenshots, diagrams, and images with callout rectangles, arrows, labels, and color-coded highlights using PIL. Includes rules for animated GIF annotations with timing and pacing.
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7246
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。