Image convert

From meowgorithm/dotfiles · View interactive version

Image convert is an AI agent skill from the GitHub repository meowgorithm/dotfiles. Convert images between formats (PNG, JPEG, WebP, GIF, BMP, TIFF, AVIF, HEIC) with quality control and resizing. Use when the user needs to convert images, batch process multiple files, optimize image sizes, or convert to modern formats like WebP or AVIF.

How to use this skill

Skill file

Image Convert

Convert images between formats with quality control, resizing, and batch

processing support.

Supported Formats

| Format | Extension | Notes |

| ------ | ------------ | ------------------------------------ |

| PNG | .png | Lossless, supports transparency |

| JPEG | .jpg, .jpeg | Lossy compression, no transparency |

| WebP | .webp | Modern format, good compression |

| GIF | .gif | Animation support (first frame only) |

| BMP | .bmp | Uncompressed, large files |

| TIFF | .tiff, .tif | High quality, large files |

| AVIF | .avif | Next-gen format, best compression |

| HEIC | .heic, .heif | Apple format |

Quick Start

Single File Conversion

Convert by specifying output extension:

scripts/convert.sh input.png output.jpg

Or specify format explicitly:

scripts/convert.sh -f webp input.png output.webp

With Quality and Resize

# Convert to JPEG with 90% quality and resize to 1920px width
scripts/convert.sh -f jpg -q 90 -r 1920x input.png output.jpg

# Convert to WebP at 50% of original size
scripts/convert.sh -f webp -q 85 -r 50% input.png output.webp

Batch Conversion

Convert all PNG files to WebP:

scripts/convert.sh -f webp *.png

Output files will have the same basename with the new extension.

Command Options

| Option | Description | Example |

| --------------- | --------------------------- | ---------------------- |

| -f, --format | Output format | -f webp |

| -q, --quality | Quality 1-100 (default: 85) | -q 90 |

| -r, --resize | Resize geometry | -r 800x600, -r 50% |

| -v, --verbose | Show conversion commands | -v |

| -h, --help | Show help | -h |

Resize Geometry

| Syntax | Description | Example |

| ------ | ------------------------------- | --------- |

| WxH | Exact dimensions (may crop) | 800x600 |

| Wx | Width only, height proportional | 1920x |

| xH | Height only, width proportional | x1080 |

| W% | Percentage of original | 50% |

Tool Dependencies

The script uses available tools in this priority:

  1. ImageMagick (magick or convert): Primary tool for all formats
  1. cwebp/dwebp: Optimized WebP conversion when available
  2. sips (macOS): Can be used as fallback on macOS

Install ImageMagick for full functionality:

# macOS
brew install imagemagick webp

# Ubuntu/Debian
sudo apt-get install imagemagick webp

# Arch
sudo pacman -S imagemagick libwebp

Common Workflows

Optimize Images for Web

Convert to WebP with good quality and reasonable size:

scripts/convert.sh -f webp -q 80 -r 1200x *.png

Create Thumbnails

Generate 300px wide thumbnails:

for img in *.jpg; do
    scripts/convert.sh -f jpg -q 75 -r 300x "$img" "thumbs/$img"
done

Convert HEIC to JPEG

scripts/convert.sh -f jpg -q 95 IMG_1234.HEIC output.jpg

PNG to Lossy for Smaller Size

scripts/convert.sh -f webp -q 85 large.png small.webp

Related Skills

fps, trimming, looping, and scaling with ffmpeg + img2webp.

Tips

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.