Agent skill

Image Trim

by godot-fun in godot-fun/gai

Trims invalid border regions (transparent or solid-color padding) from images using Pillow.

MITAuto-check passedGame Development

Install Image Trim

skills CLI
$ npx skills add godot-fun/gai --skill image-trim -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install godot-fun/gai image-trim --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/godot-fun/gai.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/image-trim .claude/skills/image-trim && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
image-trim
GitHub stars
182
Token cost
~1.9k tokens
SKILL.md length
677 words
Files
1
Skills in repo
36
Repo updated
First seen
Licence
MIT

At a glance

Trims invalid border regions (transparent or solid-color padding) from images using Pillow.

  • Works in 5 steps: Pick skill — remove padding/margins →… → Paths — Pass whatever image path the… → One file per run — trim one image,… → …
  • The user wants image trim
  • SKILL.md covers Rules, Setup (first run), Quick Start and Detection Modes, plus 7 more sections
  • Calls python and git

What it does

Image Trim is an agent skill from godot-fun/gai. Trims invalid border regions (transparent or solid-color padding) from images using Pillow. Default crop preserves the source aspect ratio. Use when the user wants image trim, crop empty borders, remove transparent margins, trim white padding, auto-crop sprites, or tighten cutouts before Godot import.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Game Development, covering Game development. It works with Godot and Python. The repository describes itself as: A lightweight AI agent and skill workflow framework built with Godot. The licence is MIT.

When your agent uses it

  • The user wants image trim
  • Crop empty borders
  • Remove transparent margins
  • Trim white padding

Example prompts

  • “Use the image-trim skill to trim invalid border regions (transparent or solid-color padding) from images using Pillow”
  • “/image-trim”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Pick skill — remove padding/margins → this skill; remove backgrounds → image-remove-white-background or image-remove-background.
  2. Paths — Pass whatever image path the user gives. Output lands in image-trim/ next to that file by default.
  3. One file per run — trim one image, verify dimensions, then repeat for additional files if needed.
  4. After background removal — run on image-remove-background/ outputs to drop excess transparent canvas.
  5. Revert — delete output file or git restore; sources are never modified.

What it can do on your machine

Read from SKILL.md and the folder at commit aa1ac71. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python
    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Image Trim loads about 1.9k tokens when it runs. Until then it costs about 78 tokens; SKILL.md has 677 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~78
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from godot-fun/gai at commit aa1ac71, republished under its MIT licence (© godot-fun). 677 words, ~1,872 tokens.

Download SKILL.mdSave it as .claude/skills/image-trim/SKILL.md (or your agent's skills folder).
name
image-trim
description
Trims invalid border regions (transparent or solid-color padding) from images using Pillow. Default crop preserves the source aspect ratio. Use when the user wants image trim, crop empty borders, remove transparent margins, trim white padding, auto-crop sprites, or tighten cutouts before Godot import.

Image Trim

Remove invalid border padding — transparent margins, flat white/green edges, or unused canvas space — with Pillow. Default: preserve the source aspect ratio so trimmed sprites stay proportionally consistent with the original frame.

Unlike --crop on image-remove-white-background (tight alpha bbox only), this skill expands the crop box to match the original width:height ratio while removing as much empty area as possible.

Rules

When this skill applies, read and follow skill-dependency-manager — run scripts as documented, install missing tools into .dependency/.

  • Run trim.py through the image-trim manifest entry (.dependency/image-trim/.venv/). Never use host python, py, python3, or any interpreter outside .dependency/.
  • Do not hand-write ImageMagick / FFmpeg crop commands — use the bundled script.
  • Single file only. Pass one image with --image; directories are not supported.
  • populated: false for image-trim is not a reason to skip. Install first, set populated: true, retry the same command.
  • Pass the input path as-is. Output goes to <image-dir>/image-trim/ by default — no path rewriting; never overwrite sources.
  • Crop only — preserve source pixel data and alpha; never composite onto black/white or fill background colors.
  • Output filenames keep the original asset name (e.g. bullet_speed.png). Cursor chat attachment paths like empty-window_images_bullet_speed-<uuid>.png are shortened automatically.

Setup (first run)

From project root:

bash
.dependency/python/python -m venv .dependency/image-trim/.venv
.dependency/image-trim/.venv/Scripts/python.exe -m pip install Pillow

Register in .dependency/manifest.json:

json
"image-trim": {
  "populated": true,
  "bin": ".dependency/image-trim/.venv/Scripts/python.exe"
}

Use bin/python on Unix.

Quick Start

Default: create an image-trim/ folder beside the input file and write the output there:

bash
# Auto-detect transparent or solid-color borders (default)
# image/sprites/hero.png → image/sprites/image-trim/hero.png
.dependency/image-trim/.venv/Scripts/python.exe .ai/image-trim/trim.py --image image/sprites/hero.png

Custom output path:

bash
.dependency/image-trim/.venv/Scripts/python.exe .ai/image-trim/trim.py --image image/sprites/hero.png -o image/sprites_trimmed

Detection Modes

ModeBehavior
auto (default)Use alpha when the image has transparency; otherwise sample corner color and trim solid borders
alphaTrim only by alpha — pixels above --alpha-threshold count as content
colorTrim pixels matching --color (or corner sample) within --tolerance
bash
# Force alpha-only trim on RGBA cutouts
.dependency/image-trim/.venv/Scripts/python.exe .ai/image-trim/trim.py --image image/cutout.png --mode alpha

# Trim white padding on opaque JPG/PNG
.dependency/image-trim/.venv/Scripts/python.exe .ai/image-trim/trim.py --image image/foo.jpg --mode color --color FFFFFF

Defaults

OptionDefaultNotes
--imageRequiredSingle supported image file
Output<image-dir>/image-trim/<name>Use -o / --output for custom file or directory
Aspect ratioPreserve sourcePass --tight for tight bbox crop (no aspect lock)
--modeautoalpha for transparent PNGs; color for flat backgrounds
--alpha-threshold10Lower = stricter transparency detection
--tolerance25Color distance for solid-border trim
--padding0Extra pixels kept around detected content

Supported inputs: .png, .jpg, .jpeg, .webp, .gif, .bmp, .tif, .tiff, .avif, .ico.

Aspect Ratio Behavior

Default (preserve source): After detecting the content bounding box, the script expands the crop rectangle to the same width:height ratio as the source image, centered on the content. This removes empty borders while keeping frame proportions stable for animation sheets and UI assets.

Tight crop (--tight): Crop exactly to the content bbox (plus --padding) — same behavior as --crop on background-removal skills.

bash
# Tight crop — smallest rectangle around content
.dependency/image-trim/.venv/Scripts/python.exe .ai/image-trim/trim.py --image image/sprites/hero.png --tight

# Keep 4 px breathing room, still preserve aspect ratio
.dependency/image-trim/.venv/Scripts/python.exe .ai/image-trim/trim.py --image image/sprites/hero.png --padding 4
Show full SKILL.md (272 more words)Show less

Agent Workflow

  1. Pick skill — remove padding/margins → this skill; remove backgrounds → image-remove-white-background or image-remove-background.
  2. Paths — Pass whatever image path the user gives. Output lands in image-trim/ next to that file by default.
  3. One file per run — trim one image, verify dimensions, then repeat for additional files if needed.
  4. After background removal — run on image-remove-background/ outputs to drop excess transparent canvas.
  5. Revert — delete output file or git restore; sources are never modified.

Agent Notes

  1. Use the bundled script, not hand-written ImageMagick / FFmpeg crop commands.
  2. Missing image-trim venv → populate .dependency/ per skill-dependency-manager, retry same command.
  3. Do not copy, move, or replace the source with trimmed output — tell the user where the output file is.
  4. Need background removal first → image-remove-white-background or image-remove-background.

Troubleshooting

IssueFix
image-trim missing in manifestFollow Setup; update manifest
Directory passed to --imageRun once per file; this skill accepts image files only
Output already existsDelete the existing output or choose a different -o path
Nothing trimmedContent may already fill the canvas; try --mode color with --color
Too much removedLower --tolerance or --alpha-threshold; add --padding
Borders remainRaise --tolerance; use --mode color with explicit --color
Distorted proportions after trimDo not pass --tight unless user wants tight bbox
JPEG saved with wrong modeScript converts RGBA → RGB automatically for .jpg output
Output has black instead of transparencySource may be JPEG data saved with a .png extension (Cursor attachments) — re-supply the original RGBA PNG
Long Cursor attachment filenamesScript auto-renames to the embedded asset name (bullet_speed.png, etc.)

CLI

Copy-paste commands: cli/image-trim.md

© godot-fun, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/image-trim of godot-fun/gai.

Open the folder on GitHubat commit aa1ac71

Compare with similar skills

Image Trim next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Image Trim compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Image Trim this skillgodot-fun/gai182—~1.9kAutomated safety check: PassMIT
2D Map and Scene Generator0x0funky/agent-sprite-forge4.4k—~2.9kAutomated safety check: PassMIT
Godot E2ERandallLiuXin/GodotMaker5501 repos~3.9kAutomated safety check: PassCustom licence
GdtoolkitRandallLiuXin/GodotMaker5501 repos~2.2kAutomated safety check: PassCustom licence
Godot Gdscript Patterns925236118/AlphaAgent10310 repos~5kAutomated safety check: PassMIT
Godot UI Integrationzimo-xiao-zheng/godot-ui-integration277—~1.5kAutomated safety check: PassMIT

Similar skills

  • 2D Map and Scene Generator

    0x0funky/agent-sprite-forge

    Plans and builds 2D game maps and scenes, from tilemaps and parallax backgrounds to HD-2D plates, with collision checks, a playable HTML preview and Tiled, Godot or LDtk export.

    4.4k GitHub stars~2.9k tokensUpdated 3 days ago
    Game DevelopmentAuto-check passed
  • Godot E2E

    RandallLiuXin/GodotMaker

    Write and run E2E (end-to-end) game tests using the godot-e2e framework.

    550 GitHub starsUsed in 1 repo~3.9k tokens
    Testing & QAAuto-check passed
  • Gdtoolkit

    RandallLiuXin/GodotMaker

    Lint and format GDScript files using gdtoolkit (gdlint + gdformat).

    550 GitHub starsUsed in 1 repo~2.2k tokens
    DevelopmentAuto-check passed
  • Godot Gdscript Patterns

    925236118/AlphaAgent

    Master Godot 4 GDScript patterns including signals, scenes, state machines, and optimization.

    103 GitHub starsUsed in 10 repos~5k tokens
    Game DevelopmentAuto-check passed
  • Godot UI Integration

    zimo-xiao-zheng/godot-ui-integration

    Build or revise Godot UI from an approved design, separated art, or a visual reference when scene structure, gameplay binding, and runtime visual verification all matter.

    277 GitHub stars~1.5k tokensUpdated 1 mo ago
    Game DevelopmentAuto-check passed
  • Godot Wechat Minigame Adapter

    godothub/godot-minigame

    Apply the bundled self-contained Godot WeChat Mini Game adapter kit to an official Godot checkout.

    187 GitHub stars~1.5k tokensUpdated 24 days ago
    Game DevelopmentAuto-check passed

More from godot-fun/gai

All 36 skills in this repo
  • AI Text To Speech

    godot-fun/gai

    Zero-shot text-to-speech with voice cloning via IndexTTS2 (index-tts).

    182 GitHub stars~2k tokensUpdated today
    Auto-check passed
  • Audio Denoise

    godot-fun/gai

    Reduces background noise in a single audio file using FFmpeg afftdn.

    182 GitHub stars~465 tokensUpdated today
    Auto-check passed
  • Audio Fade

    godot-fun/gai

    Applies fade-in and fade-out at the start and end of a single audio file using FFmpeg.

    182 GitHub stars~652 tokensUpdated today
    Auto-check passed
  • Normalizes a single audio file to consistent LUFS loudness with true-peak limiting using FFmpeg.

    182 GitHub stars~684 tokensUpdated today
    Auto-check passed
  • Standardizes a single audio file to 44100 or 48000 Hz and exports 16-bit PCM WAV using FFmpeg.

    182 GitHub stars~638 tokensUpdated today
    Auto-check passed
  • Audio Split

    godot-fun/gai

    Splits a single audio file into two segments (part 1 before the split point, part 2 after) using FFmpeg.

    182 GitHub stars~554 tokensUpdated today
    Auto-check passed

Works with

Questions about Image Trim

What does Image Trim do?

Trims invalid border regions (transparent or solid-color padding) from images using Pillow. Image Trim is an agent skill from godot-fun/gai. Trims invalid border regions (transparent or solid-color padding) from images using Pillow.

When should I use Image Trim?

Image Trim fits situations like: the user wants image trim; crop empty borders; remove transparent margins; trim white padding.

How do I install Image Trim in Claude Code?

Run `npx skills add godot-fun/gai --skill image-trim -a claude-code`. Or copy the skill folder (.agents/skills/image-trim in godot-fun/gai) into .claude/skills/image-trim in your project. Claude Code loads it when a task matches its description.

How do I install Image Trim in Codex?

Run `npx skills add godot-fun/gai --skill image-trim -a codex`. Or copy the skill folder (.agents/skills/image-trim in godot-fun/gai) into .agents/skills/image-trim in your project. Codex loads it when a task matches its description.

Can I use Image Trim in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add godot-fun/gai --skill image-trim -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/image-trim, .gemini/skills/image-trim, .github/skills/image-trim and .opencode/skills/image-trim in your project.

What does Image Trim need to run?

Going by SKILL.md and its folder, Image Trim needs the command-line tools its instructions call (python and git). Our summary lists: Python 3.

Does Image Trim access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Image Trim safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Image Trim use?

Image Trim is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Image Trim use?

About 1.9k tokens (SKILL.md is roughly 7.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Image Trim?

Skills that share tags, products or a category with Image Trim: 2D Map and Scene Generator (0x0funky/agent-sprite-forge, 4.4k stars), Godot E2E (RandallLiuXin/GodotMaker, 550 stars), Gdtoolkit (RandallLiuXin/GodotMaker, 550 stars) and Godot Gdscript Patterns (925236118/AlphaAgent, 103 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Image Trim?

godot-fun (a GitHub organization) maintains it in godot-fun/gai, which has 182 GitHub stars. The repository holds 36 skills in this directory. The repository was last updated on October 9, 2026.

Source: godot-fun/gai on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.