agentleFS
huihuisanghuihuisang/ajigu-skills/skills/smooth-alpha-edges/SKILL.md

smooth-alpha-edges

Skill0 starsChanged 20 days agoMITView on GitHub

Repair jagged or noisy outer silhouettes in transparent raster images while preserving the original interior pixels. Use for PNG/WebP cutouts whose alpha boundary is stair-stepped, fringed, or geometrically uneven; do not use when the subject itself should be redrawn.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the silhouette is already geometrically correct but has a hard binary transition, resampling plus an 8-bit alpha edge may be sufficient.

    line 20
  2. Distinctive:

    If the boundary position visibly wobbles, contains bumps, or follows pixel stairs, rebuild the silhouette with a continuous path.

    line 21
  3. Distinctive:

    Keep the path slightly inside the original opaque boundary when transparent pixels do not contain usable RGB data.

    line 27
  4. Distinctive:

    Run the bundled deterministic helper:

    line 34
  5. Distinctive:

    Check both light and dark contrasting backgrounds when fringe color matters.

    line 51
  6. Distinctive:

    Use generative image editing only when the user permits changes to the subject.

    line 56

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Smooth Alpha Edges

Repair the alpha geometry, not merely the image resolution. Upscaling a bad 1-bit outline only creates larger stair steps, and blurring it only softens the wrong contour.

Diagnose first

Inspect the source with ImageMagick:

magick identify -verbose input.png | rg 'Geometry:|Type:|Alpha:'

Distinguish two cases:

  • If the silhouette is already geometrically correct but has a hard binary transition, resampling plus an 8-bit alpha edge may be sufficient.
  • If the boundary position visibly wobbles, contains bumps, or follows pixel stairs, rebuild the silhouette with a continuous path. Do not rely on resize, blur, erosion, or median filtering as the final fix.

Rebuild a silhouette

  1. Preserve the original file and work on a sibling output until the result is approved.
  2. Trace only the outer silhouette as a closed path in the source image's pixel coordinate system. Use M, L, C, and Z; prefer a small number of cubic Bezier segments over many points.
  3. Keep the path slightly inside the original opaque boundary when transparent pixels do not contain usable RGB data. This avoids dark or white fringe from previously transparent pixels.
  4. Save only the path data in a text file, for example:
M 20,10 C 12,10 8,18 8,30 L 8,180 C 8,192 16,200 28,200 L 92,200 C 104,200 112,192 112,180 L 112,30 C 112,18 108,10 100,10 Z
  1. Run the bundled deterministic helper:
scripts/rebuild_vector_alpha.sh \
  --input input.png \
  --output input-smoothed.png \
  --path-file silhouette.path \
  --scale 3 \
  --preview input-smoothed-preview.png \
  --preview-width 600

The helper preserves the source color content, renders the path at higher resolution, adds a controlled subpixel transition, and writes a true RGBA PNG.

Validate the result

  • Inspect the composited preview at the intended display size. A transparent PNG viewed at extreme 1:1 or enlarged inspection can make normal raster pixel steps look worse than the rendered result.
  • Check both light and dark contrasting backgrounds when fringe color matters.
  • Confirm the output reports TrueColorAlpha with 8-bit alpha.
  • Compare interior seams, texture, color, proportions, and placement against the source; only the outer boundary should change.
  • Reject black/white halos, clipped corners, expanded transparent RGB artifacts, excessive softness, and subject redesign.

Use generative image editing only when the user permits changes to the subject. For preservation-sensitive cutouts, prefer this deterministic path-mask workflow.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.