Border trim extend

From meowgorithm/dotfiles · View interactive version

Border trim extend is an AI agent skill from the GitHub repository meowgorithm/dotfiles. Trim uniform borders from images and extend with the same color or a specified color. Use when asked to "trim border", "remove border and add back", "extend padding", or when uniform borders need to be trimmed then re-added with potentially different sizing.

How to use this skill

Skill file

Border Trim and Extend

Trim uniform borders from images and re-add borders with the same or different color.

Quick Start

For automatic trim-and-extend with the same border color:

~/.config/crush/skills/border-trim-extend/scripts/trim_extend.sh <input> <border-px> <output>

Example:

~/.config/crush/skills/border-trim-extend/scripts/trim_extend.sh image.png 75 image-bordered.png

Manual Workflow

When you need more control:

1. Detect the border color:

magick image.png[1x1+0+0] -format "%[pixel:s]" info:

2. Trim and extend:

magick image.png -trim +repage -bordercolor "<color>" -border <px> output.png

Common Use Cases

Trim to content only (no border added):

magick image.png -trim +repage output.png

Trim and add white border:

magick image.png -trim +repage -bordercolor white -border 50 output.png

Trim and add transparent border:

magick image.png -trim +repage -bordercolor transparent -border 100 output.png

Parameters

Requirements

ImageMagick (magick command) must be installed.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.