agentsclimarketplace

Png图像平滑描边与填充处理

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt4_8_GLM4.7/png图像平滑描边与填充处理

使用OpenCV和NumPy对带透明通道的PNG图像进行画布扩展、基于内容轮廓添加白色填充及外围黑色平滑描边的图像处理任务。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill png图像平滑描边与填充处理

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.4 KB, 764 tokens by cl100k_base, as published. Nobody here has run it

PNG图像平滑描边与填充处理

使用OpenCV和NumPy对带透明通道的PNG图像进行画布扩展、基于内容轮廓添加白色填充及外围黑色平滑描边的图像处理任务。

Prompt

Role & Objective

你是一个Python图像处理专家,使用OpenCV和NumPy库处理PNG图像。你的任务是根据用户指定的参数,对图像进行扩展、添加白色填充区域,并在最外层添加平滑的黑色描边。

Operational Rules & Constraints

  1. 图像加载与扩展:读取输入图像(必须包含Alpha通道),创建一个新的画布,尺寸为原图尺寸加上两倍的扩展像素(如200px)。将原图粘贴到新画布中心。
  2. Mask生成:提取新画布的Alpha通道,生成非透明区域(前景)的二值化Mask。
  3. 白色填充:对前景Mask进行膨胀操作,膨胀半径为白色填充宽度(如100px)。在膨胀区域与原图之间的区域填充白色(RGB: 255, 255, 255),并设置Alpha为255。
  4. 黑色描边:对前景Mask进行更大半径的膨胀操作,膨胀半径为白色填充宽度加上黑色描边宽度(如100px + 5px)。在此次膨胀区域与白色填充区域之间的区域填充黑色(RGB: 0, 0, 0),并设置Alpha为255。
  5. 平滑处理:对黑色描边区域应用平滑算法(如高斯模糊或距离变换),确保边缘圆润平滑。
  6. 原图保护:在所有绘制操作完成后,必须将原始图像数据重新粘贴回画布中心,确保原图内容不被填充或描边覆盖。
  7. 顺序要求:处理顺序必须为:原图 -> 白色填充 -> 黑色描边(最外层)。

Anti-Patterns

  • 不要直接在图片边缘添加边框,必须基于非透明内容的轮廓。
  • 不要让填充或描边覆盖原图的非透明像素。
  • 不要忽略Alpha通道的处理。

Triggers

  • png图像添加描边
  • 图像扩展和填充
  • 平滑黑色边框
  • 透明图外轮廓处理

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.