$npx -y skills add github/awesome-copilot --skill image-manipulation-image-magickProcess 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.
| 1 | # Image Manipulation with ImageMagick |
| 2 | |
| 3 | This skill enables image processing and manipulation tasks using ImageMagick |
| 4 | across Windows, Linux, and macOS systems. |
| 5 | |
| 6 | ## When to Use This Skill |
| 7 | |
| 8 | Use this skill when you need to: |
| 9 | |
| 10 | - Resize images (single or batch) |
| 11 | - Get image dimensions and metadata |
| 12 | - Convert between image formats |
| 13 | - Create thumbnails |
| 14 | - Process wallpapers for different screen sizes |
| 15 | - Batch process multiple images with specific criteria |
| 16 | |
| 17 | ## Prerequisites |
| 18 | |
| 19 | - ImageMagick installed on the system |
| 20 | - **Windows**: PowerShell with ImageMagick available as `magick` (or at `C:\Program Files\ImageMagick-*\magick.exe`) |
| 21 | - **Linux/macOS**: Bash with ImageMagick installed via package manager (`apt`, `brew`, etc.) |
| 22 | |
| 23 | ## Core Capabilities |
| 24 | |
| 25 | ### 1. Image Information |
| 26 | |
| 27 | - Get image dimensions (width x height) |
| 28 | - Retrieve detailed metadata (format, color space, etc.) |
| 29 | - Identify image format |
| 30 | |
| 31 | ### 2. Image Resizing |
| 32 | |
| 33 | - Resize single images |
| 34 | - Batch resize multiple images |
| 35 | - Create thumbnails with specific dimensions |
| 36 | - Maintain aspect ratios |
| 37 | |
| 38 | ### 3. Batch Processing |
| 39 | |
| 40 | - Process images based on dimensions |
| 41 | - Filter and process specific file types |
| 42 | - Apply transformations to multiple files |
| 43 | |
| 44 | ## Usage Examples |
| 45 | |
| 46 | ### Example 0: Resolve `magick` executable |
| 47 | |
| 48 | **PowerShell (Windows):** |
| 49 | ```powershell |
| 50 | # Prefer ImageMagick on PATH |
| 51 | $magick = (Get-Command magick -ErrorAction SilentlyContinue)?.Source |
| 52 | |
| 53 | # Fallback: common install pattern under Program Files |
| 54 | if (-not $magick) { |
| 55 | $magick = Get-ChildItem "C:\\Program Files\\ImageMagick-*\\magick.exe" -ErrorAction SilentlyContinue | |
| 56 | Select-Object -First 1 -ExpandProperty FullName |
| 57 | } |
| 58 | |
| 59 | if (-not $magick) { |
| 60 | throw "ImageMagick not found. Install it and/or add 'magick' to PATH." |
| 61 | } |
| 62 | ``` |
| 63 | |
| 64 | **Bash (Linux/macOS):** |
| 65 | ```bash |
| 66 | # Check if magick is available on PATH |
| 67 | if ! command -v magick &> /dev/null; then |
| 68 | echo "ImageMagick not found. Install it using your package manager:" |
| 69 | echo " Ubuntu/Debian: sudo apt install imagemagick" |
| 70 | echo " macOS: brew install imagemagick" |
| 71 | exit 1 |
| 72 | fi |
| 73 | ``` |
| 74 | |
| 75 | ### Example 1: Get Image Dimensions |
| 76 | |
| 77 | **PowerShell (Windows):** |
| 78 | ```powershell |
| 79 | # For a single image |
| 80 | & $magick identify -format "%wx%h" path/to/image.jpg |
| 81 | |
| 82 | # For multiple images |
| 83 | Get-ChildItem "path/to/images/*" | ForEach-Object { |
| 84 | $dimensions = & $magick identify -format "%f: %wx%h`n" $_.FullName |
| 85 | Write-Host $dimensions |
| 86 | } |
| 87 | ``` |
| 88 | |
| 89 | **Bash (Linux/macOS):** |
| 90 | ```bash |
| 91 | # For a single image |
| 92 | magick identify -format "%wx%h" path/to/image.jpg |
| 93 | |
| 94 | # For multiple images |
| 95 | for img in path/to/images/*; do |
| 96 | magick identify -format "%f: %wx%h\n" "$img" |
| 97 | done |
| 98 | ``` |
| 99 | |
| 100 | ### Example 2: Resize Images |
| 101 | |
| 102 | **PowerShell (Windows):** |
| 103 | ```powershell |
| 104 | # Resize a single image |
| 105 | & $magick input.jpg -resize 427x240 output.jpg |
| 106 | |
| 107 | # Batch resize images |
| 108 | Get-ChildItem "path/to/images/*" | ForEach-Object { |
| 109 | & $magick $_.FullName -resize 427x240 "path/to/output/thumb_$($_.Name)" |
| 110 | } |
| 111 | ``` |
| 112 | |
| 113 | **Bash (Linux/macOS):** |
| 114 | ```bash |
| 115 | # Resize a single image |
| 116 | magick input.jpg -resize 427x240 output.jpg |
| 117 | |
| 118 | # Batch resize images |
| 119 | for img in path/to/images/*; do |
| 120 | filename=$(basename "$img") |
| 121 | magick "$img" -resize 427x240 "path/to/output/thumb_$filename" |
| 122 | done |
| 123 | ``` |
| 124 | |
| 125 | ### Example 3: Get Detailed Image Information |
| 126 | |
| 127 | **PowerShell (Windows):** |
| 128 | ```powershell |
| 129 | # Get verbose information about an image |
| 130 | & $magick identify -verbose path/to/image.jpg |
| 131 | ``` |
| 132 | |
| 133 | **Bash (Linux/macOS):** |
| 134 | ```bash |
| 135 | # Get verbose information about an image |
| 136 | magick identify -verbose path/to/image.jpg |
| 137 | ``` |
| 138 | |
| 139 | ### Example 4: Process Images Based on Dimensions |
| 140 | |
| 141 | **PowerShell (Windows):** |
| 142 | ```powershell |
| 143 | Get-ChildItem "path/to/images/*" | ForEach-Object { |
| 144 | $dimensions = & $magick identify -format "%w,%h" $_.FullName |
| 145 | if ($dimensions) { |
| 146 | $width,$height = $dimensions -split ',' |
| 147 | if ([int]$width -eq 2560 -or [int]$height -eq 1440) { |
| 148 | Write-Host "Processing $($_.Name)" |
| 149 | & $magick $_.FullName -resize 427x240 "path/to/output/thumb_$($_.Name)" |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | ``` |
| 154 | |
| 155 | **Bash (Linux/macOS):** |
| 156 | ```bash |
| 157 | for img in path/to/images/*; do |
| 158 | dimensions=$(magick identify -format "%w,%h" "$img") |
| 159 | if [[ -n "$dimensions" ]]; then |
| 160 | width=$(echo "$dimensions" | cut -d',' -f1) |
| 161 | height=$(echo "$dimensions" | cut -d',' -f2) |
| 162 | if [[ "$width" -eq 2560 || "$height" -eq 1440 ]]; then |
| 163 | filename=$(basename "$img") |
| 164 | echo "Processing $filename" |
| 165 | magick "$img" -resize 427x240 "path/to/output/thumb_$filename" |
| 166 | fi |
| 167 | fi |
| 168 | done |
| 169 | ``` |
| 170 | |
| 171 | ## Guidelines |
| 172 | |
| 173 | 1. **Always quote file paths** - Use quotes around file paths that mi |