Process and manipulate images using ImageMagick. Supports resizing, format conversion, batch processing, and retrieving image metadata. Use when working with images, creating thumbnails, resizing wallpapers, or performing batch image operations.
Requires ImageMagick installed and available as `magick` on PATH. Cross-platform examples provided for PowerShell (Windows) and Bash (Linux/macOS).aigithub-copilotprompt-engineeringhacktoberfestagent-skillsagents
Image Manipulation with ImageMagick
This skill enables image processing and manipulation tasks using ImageMagick
across Windows, Linux, and macOS systems.
When to Use This Skill
Use this skill when you need to:
Resize images (single or batch)
Get image dimensions and metadata
Convert between image formats
Create thumbnails
Process wallpapers for different screen sizes
Batch process multiple images with specific criteria
Prerequisites
ImageMagick installed on the system
Windows: PowerShell with ImageMagick available as magick (or at C:\Program Files\ImageMagick-*\magick.exe)
Linux/macOS: Bash with ImageMagick installed via package manager (apt, brew, etc.)
Core Capabilities
1. Image Information
Get image dimensions (width x height)
Retrieve detailed metadata (format, color space, etc.)
Identify image format
2. Image Resizing
Resize single images
Batch resize multiple images
Create thumbnails with specific dimensions
Maintain aspect ratios
3. Batch Processing
Process images based on dimensions
Filter and process specific file types
Apply transformations to multiple files
Usage Examples
Example 0: Resolve magick executable
PowerShell (Windows):
# Prefer ImageMagick on PATH
$magick = (Get-Command magick -ErrorAction SilentlyContinue)?.Source
# Fallback: common install pattern under Program Files
if (-not $magick) {
$magick = Get-ChildItem "C:\\Program Files\\ImageMagick-*\\magick.exe" -ErrorAction SilentlyContinue |
Select-Object -First 1 -ExpandProperty FullName
}
if (-not $magick) {
throw "ImageMagick not found. Install it and/or add 'magick' to PATH."
}
Bash (Linux/macOS):
# Check if magick is available on PATH
if ! command -v magick &> /dev/null; then
echo "ImageMagick not found. Install it using your package manager:"
echo " Ubuntu/Debian: sudo apt install imagemagick"
echo " macOS: brew install imagemagick"
exit 1
fi
Example 1: Get Image Dimensions
PowerShell (Windows):
# For a single image
& $magick identify -format "%wx%h" path/to/image.jpg
# For multiple images
Get-ChildItem "path/to/images/*" | ForEach-Object {
$dimensions = & $magick identify -format "%f: %wx%h`n" $_.FullName
Write-Host $dimensions
}
Bash (Linux/macOS):
# For a single image
magick identify -format "%wx%h" path/to/image.jpg
# For multiple images
for img in path/to/images/*; do
magick identify -format "%f: %wx%h\n" "$img"
done