agentleFS
rajnandan1rajnandan1/such-skills/skills/format-convert/SKILL.md

format-convert

Skill3 starsChanged 9 months agoMITView on GitHub

Convert images between formats: PNG, JPG/JPEG, WebP, TIFF, BMP, GIF, HEIC, and AVIF. Performs high-quality lossless conversion by default. Handles alpha channel transparency automatically — compositing against a configurable background color when converting to formats that lack alpha support (JPG, BMP). Supports single-file and batch directory conversion with optional recursive subdirectory scanning. Uses ImageMagick. Use this skill whenever the user wants to: convert an image to another format, change image format, save as PNG/JPG/WebP/TIFF, convert HEIC photos to JPG or PNG, batch convert images, make images web-compatible, convert to WebP for web optimization, or anything involving image format conversion. Also trigger when the user mentions format names in the context of converting, exporting, or saving images.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. 6aneffy/hwpx-kit★ 2same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository9 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    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:

    Run the bundled script:

    line 31
  2. Distinctive:

    PNG: always uses lossless encoding (quality controls compression level only)

    line 110

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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

Format Convert — Lossless Image Format Converter

Convert any image between PNG, JPG, WebP, TIFF, BMP, GIF, HEIC, and AVIF using ImageMagick. Lossless by default — preserves maximum quality and original dimensions.

Prerequisites

ImageMagick is required. For HEIC/AVIF support, ensure delegates are installed.

brew install imagemagick    # macOS
sudo apt install imagemagick # Debian/Ubuntu

How to use

Run the bundled script:

bash "${CLAUDE_SKILL_DIR}/scripts/convert.sh" <input-image> --to FORMAT [OPTIONS]

Options

FlagDescriptionDefault
--to FORMATTarget format (png, jpg, webp, tiff, bmp, gif, heic, avif)(required)
--output DIROutput directory./converted/
--quality NQuality for lossy formats 1-100100
--bg-color HEXBackground color when removing alpha (6-digit hex, no #)FFFFFF
--batch DIRConvert all supported images in a directory—
--recursiveInclude subdirectories in batch modeoff
--formatsList supported formats and exit—

Supported formats

For the full reference with alpha support, lossy/lossless details, and conversion notes, read references/formats.md.

FormatAlphaQuality
PNGyeslossless
JPGnolossy
WebPyesboth
TIFFyeslossless
BMPnolossless
GIFyes (1-bit)lossless
HEICyeslossy
AVIFyesboth

Examples

Convert PNG to JPG:

bash "${CLAUDE_SKILL_DIR}/scripts/convert.sh" screenshot.png --to jpg

Convert HEIC photos to PNG:

bash "${CLAUDE_SKILL_DIR}/scripts/convert.sh" photo.heic --to png

Convert to WebP for web optimization:

bash "${CLAUDE_SKILL_DIR}/scripts/convert.sh" banner.png --to webp --quality 90

Batch convert all images in a folder to WebP:

bash "${CLAUDE_SKILL_DIR}/scripts/convert.sh" --batch ./images/ --to webp --output ./web-images/

Batch convert recursively:

bash "${CLAUDE_SKILL_DIR}/scripts/convert.sh" --batch ./photos/ --to jpg --recursive --output ./exported/

Transparent PNG to JPG with custom background:

bash "${CLAUDE_SKILL_DIR}/scripts/convert.sh" logo.png --to jpg --bg-color 000000

List supported formats:

bash "${CLAUDE_SKILL_DIR}/scripts/convert.sh" --formats

How it works

The script uses ImageMagick for all conversions with a lossless-first strategy:

  1. Alpha detection — Before converting to a non-alpha format (JPG, BMP), the script checks whether the source image actually has transparency using magick identify -format "%A". Only images with real alpha data get flattened against the background color.
  2. Quality maximization — The default quality is 100. For formats that support true lossless encoding:
    • WebP at quality 100 enables webp:lossless=true
    • AVIF at quality 100 enables heif:lossless=true
    • PNG always uses lossless encoding (quality controls compression level only)
    • TIFF uses uncompressed output (-compress None)
  3. Dimension preservation — The script never resizes. Output dimensions always match the source.
  4. Same-format skip — If the source is already the target format, the file is skipped rather than re-encoded.

Format notes

  • Animated GIFs — Only the first frame is converted. Full animation conversion is not supported.
  • HEIC/AVIF — Require ImageMagick delegates (libheif). If not installed, conversion will fail with a clear error.
  • JPG/BMP from transparent sources — Alpha is composited against --bg-color (default white). Opaque sources pass through unchanged.

Output naming

Files are saved as <original-name>.<target-ext> in the output directory. For example:

  • converted/screenshot.jpg
  • converted/photo.png
  • converted/banner.webp

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.