← Browse

@ecnu-icalk/png

B

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

skillclaude

Install

agr install @ecnu-icalk/png --target claude

Writes 1 file into .claude/skills/, pinned to git-a50287dd.

  • .claude/skills/png/SKILL.md

Document


id: "26abda9f-67c4-4792-904e-77adf56dd820" name: "PNG图像平滑描边与填充处理" description: "使用OpenCV和NumPy对带透明通道的PNG图像进行画布扩展、基于内容轮廓添加白色填充及外围黑色平滑描边的图像处理任务。" version: "0.1.0" tags:

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

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图像添加描边
  • 图像扩展和填充
  • 平滑黑色边框
  • 透明图外轮廓处理

Trustgrade B

  • passBody integrity

    Whether the stored document is plausibly the kind of file the artifact declares, rather than something fetched by mistake.

  • passType matchnot applicable to this artifact type

    Whether the artifact is really the kind of thing its metadata claims it is.

  • passFreshness

    How long since the source repository was last pushed to.

  • passPrompt injection

    Scans the artifact's own text for instructions aimed at your agent rather than at you.

  • warnLicenseno SPDX license detected

    Whether the source repository declares an SPDX license permissive enough to redistribute.

How the grade is calculated

Each check contributes 0 points when it passes, 1 when it warns, and 2 when it fails. The total maps to a letter:

  • Aevery check passed
  • Bone warning
  • Ctwo warnings
  • Dprompt injection or body integrity failed, or three warnings
  • Fone of those failed, and something else is wrong

These are automated hygiene checks, not a security audit, and not a dependency or vulnerability scan. A grade of A means nothing was flagged — not that the artifact is safe.

Versions

  • git-a50287dd2b582026-07-31