Summary
对 PNG/JPG/WebP 等位图做小范围局部替换、局部遮盖、局部文字重写或局部修补。 使用 Python/Pillow 基于矩形区域进行像素级覆盖、背景采样、颜色匹配和可选文字绘制, 保持原图尺寸、文件名和未选中区域不变。适用于用户要求“只改这一小块”“不要整图 AI 重绘”…
hugohe3/hugo-skills · Archived
对 PNG/JPG/WebP 等位图做小范围局部替换、局部遮盖、局部文字重写或局部修补。 使用 Python/Pillow 基于矩形区域进行像素级覆盖、背景采样、颜色匹? 保持原图尺寸、文件名和未选中区域不变。适用于用户要求“只改这一小块”“不要整图 AI 重绘” “替换图片里的编号/标签/日期/小段文字”“遮盖局部?
npx skills add hugohe3/hugo-skills --skill image-local-replacer
对 PNG/JPG/WebP 等位图做小范围局部替换、局部遮盖、局部文字重写或局部修补。 使用 Python/Pillow 基于矩形区域进行像素级覆盖、背景采样、颜色匹配和可选文字绘制, 保持原图尺寸、文件名和未选中区域不变。适用于用户要求“只改这一小块”“不要整图 AI 重绘”…
This repository is archived — consider an actively maintained alternative.
? 生成学习计划、预习笔记、通读笔记、Anki 复习卡片和外化产出。 当用户需要系统学习、制作学习笔记…
3 installsConvert source documents (PDF / Word / Excel / PowerPoint / EPUB / HTML / Jupyter / subtitles /…
2 installs创建和编辑可继续修改的图表源文件,支持 Draw.io、Excalidraw、Mermaid、PlantUML、Graphviz DOT、D2…
1 installs风电业务技能框架,用于逐步沉淀风电项目开发、投资分析、政策研究、技术判断、 尽职调查、招投标支持…
1 installsRelated neighbors and high-traction skills in the same topics — useful to compare before installing.
Discovers custom modules replaceable by OSS, evaluates alternatives (stars, license, CVE), gene…
282 installsReplace every occurrence of the word "hello" with "fuckk" across the entire codebase. Use this …
240 installsReplaces custom modules with OSS packages using atomic keep/discard testing. Use when migrating…
220 installsOther skills from hugohe3/hugo-skills.
npx skills add hugohe3/hugo-skills
Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
main
Files included with this skill beyond the listing page.
SKILL.md
4,700 B
SUMMARY.md
502 B
对已经固化在位图中的小范围内容做可控替换。优先使用确定性的局部像素编辑:读取原图,按配置只处理指定矩形区域,必要时从周边采样背景,再写入新内容或仅覆盖清除。
| 场景 | 推荐方式 |
|---|---|
| 替换图中编号、标签、日期、小段文字 | 覆盖旧文字区域,再按相近颜色、字号和字体写入新文字 |
| 遮盖局部敏感信息 | 用背景采样色、指定纯色或模糊前的近似色覆盖局部区域 |
| 清理旧字符残影、标注残留 | 用更小矩形做二次覆盖 |
| 修补地图、工程图、截图中的小块错误 | 只处理错误区域,保留线条、图例、边界、点位等其他内容 |
不适合:需要理解复杂语义、重建大面积背景、补全缺失物体、改变图像风格或生成新画面的任务;这些应使用专门图像编辑工作流,而不是本技能。
[left, top, right, bottom]。[x, y]、颜色、字号和字体;尽量匹配原图视觉风格。cover、background、padding、textxy、fontsize 后重跑。--overwrite 覆盖原图。坐标均为像素坐标:
{
"default": {
"font_size": 24,
"fill": "#d71920",
"stroke_width": 0
},
"items": [
{
"file": "map.png",
"description": "替换左上角机位编号",
"cover": [100, 120, 158, 148],
"text": "XD1",
"text_xy": [102, 116]
},
{
"file": "screenshot.png",
"description": "遮盖手机号",
"cover": [320, 88, 460, 116],
"background": "#ffffff"
}
]
}
字段说明:
| 字段 | 必填 | 说明 |
|---|---|---|
file |
是 | 相对输入目录的图片路径 |
cover |
是 | 要覆盖的局部矩形 [left, top, right, bottom] |
description |
否 | 人工复核说明,不参与绘制 |
text |
否 | 覆盖后写入的新文字;不填则只做局部覆盖 |
text_xy |
写文字时必填 | 新文字左上角 [x, y] |
font_size |
否 | 字号,未设置时使用 default.font_size |
font |
否 | 字体文件路径,未设置时尝试常见系统字体 |
fill |
否 | 文字颜色,支持 #RRGGBB 或 [r,g,b] |
background |
否 | 覆盖色;未设置时脚本从覆盖框周围采样中位数颜色 |
padding |
否 | 覆盖框额外扩张像素,默认 0 |
stroke_width |
否 | 文字描边宽度,默认 0 |
stroke_fill |
否 | 文字描边颜色 |
安装依赖:
pip install -r resources/requirements.txt
先输出到检查目录:
python3 scripts/apply_local_replacements.py ./images replacements.json -o ./preview-images
检查无误后覆盖原文件:
python3 scripts/apply_local_replacements.py ./images replacements.json --overwrite
如果需要辅助定位红色文字或红色标注,可生成红色像素遮罩:
python3 scripts/apply_local_replacements.py ./images replacements.json --red-mask-dir ./red-mask