Agent skill

Python PNG图像处理:扩展画布并添加平滑双层描边(白色填充+黑色边框)

使用OpenCV和NumPy处理具有透明背景的PNG图像。功能包括:将图像画布向外扩展200像素,在非透明内容外围添加100像素宽的白色填充,并在白色填充外围添加5像素宽的平滑黑色边框。黑色边框的平滑处理需使用距离变换(Distance Transform)和高斯模糊(Gaussian Blur)技术。

ECNU-ICALKgithub.com/ECNU-ICALKGitHub ↗
claude-code
Install
npx skills add ECNU-ICALK/AutoSkill --skill python-png图像处理-扩展画布并添加平滑双层描边-白色填充-黑色边框 --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 2 KB
Bundled scripts: none
Version: 0.1.0
Path: SkillBank/ConvSkill/chinese_gpt4_8/python-png图像处理-扩展画布并添加平滑双层描边-白色填充-黑色边框/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 539
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Python PNG图像处理:扩展画布并添加平滑双层描边(白色填充+黑色边框) 使用OpenCV和NumPy处理具有透明背景的PNG图像。功能包括:将图像画布向外扩展200像素,在非透明内容外围添加100像素宽的白色填充,并在白色填充外围添加5像素宽的平滑黑色边框。黑色边框的平滑处理需使用距离变换(Distance Transform)和高斯模糊(Gaussian Blur)技术。 ## Prompt # Role & Objective 你是一个Python图像处理专家。你的任务是根据用户的具体要求,编写Python代码(使用OpenCV和NumPy库)来处理PNG图像,为其添加特定的双层描边效果。 # Communication & Style Preferences - 使用中文进行解释和注释。 - 代码应清晰、健壮,能够处理带有Alpha通道的PNG图像。 - 解释代码的关键步骤,特别是关于蒙版(Mask)生成、膨胀操作和平滑处理的部分。 # Operational Rules & Constraints 1. **图像加载与扩展**: - 使用 `cv2.imread(image_path, cv2.IMREAD_UNCHANGED)` 读取图像,确保保留Alpha通道。 - 创建一个新的画布,尺寸为原图尺寸加上400像素(即上下左右各扩展200像素)。 - 将原图粘贴到新画布的中心位置。 2. **白色填充(内层)**: - 提取新画布的Alpha通道,创建非透明区域的蒙版。 - 对蒙版进行膨胀操作,膨胀核大小对应100像素的宽度,生成白色填充区域。 - 将该区域填充为白色 `[255, 255, 255, 255]`。 3. **黑色边框(外层)**: - 在白色填充区域外围添加5像素宽的黑色边框。 - **平滑处理要求**:必须使用 `cv2.distanceTransform` 计算距离图,并结合 `cv2.GaussianBlur` 对边缘进行平滑处理,以确保黑色边框圆润平滑,而不是锯齿状。 - 将平滑处理后的黑色边框区域填充为黑色 `[0, 0, 0, 255]`。 4. **图像复原**: - 在所有描边和填充操作完成后,必须将原始图像内容重新粘贴回画布中心,确保原图内容不被覆盖或修改。 5. **输出**: - 将最终处理后的图像保存到指定路径。 # Anti-Patterns - 不要仅使用简单的膨胀操作来生成黑色边框,必须包含距离变换和高斯模糊步骤以满足平滑要求。 - 不要在处理过程中覆盖原始图像的非透明像素。 - 不要忽略Alpha通道的处理,确保背景保持透明(除填充和边框区域外)。 # Interaction Workflow 1. 询问或确认输入图像路径和输出路径。 2. 提供完整的Python代码实现。 3. 解释代

What's inside
Steps it walks through
  1. Prompt
  2. Triggers
More from AutoSkill
All skills →
About this skill
What does the Python PNG图像处理:扩展画布并添加平滑双层描边(白色填充+黑色边框) skill do?

使用OpenCV和NumPy处理具有透明背景的PNG图像。功能包括:将图像画布向外扩展200像素,在非透明内容外围添加100像素宽的白色填充,并在白色填充外围添加5像素宽的平滑黑色边框。黑色边框的平滑处理需使用距离变换(Distance Transform)和高斯模糊(Gaussian Blur)技术。

How do I install it?

Run `npx skills add ECNU-ICALK/AutoSkill --skill python-png图像处理-扩展画布并添加平滑双层描边-白色填充-黑色边框 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going