From 73e9677ada1df1928fcedcfa810ec93013e34a33 Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Fri, 19 Dec 2025 13:14:32 -0800 Subject: [PATCH 1/5] add image magick skill --- .../image-manipulation-image-magick/SKILL.md | 252 ++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 skills/image-manipulation-image-magick/SKILL.md diff --git a/skills/image-manipulation-image-magick/SKILL.md b/skills/image-manipulation-image-magick/SKILL.md new file mode 100644 index 000000000..9f56b79f5 --- /dev/null +++ b/skills/image-manipulation-image-magick/SKILL.md @@ -0,0 +1,252 @@ +--- +name: image-manipulation +description: 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. +compatibility: Requires ImageMagick installed and available as `magick` on PATH. Cross-platform examples provided for PowerShell (Windows) and Bash (Linux/macOS). +--- + +# 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):** +```powershell +# 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):** +```bash +# 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):** +```powershell +# 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):** +```bash +# 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 +``` + +### Example 2: Resize Images + +**PowerShell (Windows):** +```powershell +# Resize a single image +& $magick input.jpg -resize 427x240 output.jpg + +# Batch resize images +Get-ChildItem "path/to/images/*" | ForEach-Object { + & $magick $_.FullName -resize 427x240 "path/to/output/thumb_$($_.Name)" +} +``` + +**Bash (Linux/macOS):** +```bash +# Resize a single image +magick input.jpg -resize 427x240 output.jpg + +# Batch resize images +for img in path/to/images/*; do + filename=$(basename "$img") + magick "$img" -resize 427x240 "path/to/output/thumb_$filename" +done +``` + +### Example 3: Get Detailed Image Information + +**PowerShell (Windows):** +```powershell +# Get verbose information about an image +& $magick identify -verbose path/to/image.jpg +``` + +**Bash (Linux/macOS):** +```bash +# Get verbose information about an image +magick identify -verbose path/to/image.jpg +``` + +### Example 4: Process Images Based on Dimensions + +**PowerShell (Windows):** +```powershell +Get-ChildItem "path/to/images/*" | ForEach-Object { + $dimensions = & $magick identify -format "%w,%h" $_.FullName + if ($dimensions) { + $width,$height = $dimensions -split ',' + if ([int]$width -eq 2560 -or [int]$height -eq 1440) { + Write-Host "Processing $($_.Name)" + & $magick $_.FullName -resize 427x240 "path/to/output/thumb_$($_.Name)" + } + } +} +``` + +**Bash (Linux/macOS):** +```bash +for img in path/to/images/*; do + dimensions=$(magick identify -format "%w,%h" "$img") + if [[ -n "$dimensions" ]]; then + width=$(echo "$dimensions" | cut -d',' -f1) + height=$(echo "$dimensions" | cut -d',' -f2) + if [[ "$width" -eq 2560 || "$height" -eq 1440 ]]; then + filename=$(basename "$img") + echo "Processing $filename" + magick "$img" -resize 427x240 "path/to/output/thumb_$filename" + fi + fi +done +``` + +## Guidelines + +1. **Always quote file paths** - Use quotes around file paths that might contain spaces +2. **Use the `&` operator (PowerShell)** - Invoke the magick executable using `&` in PowerShell +3. **Store the path in a variable (PowerShell)** - Assign the ImageMagick path to `$magick` for cleaner code +4. **Wrap in loops** - When processing multiple files, use `ForEach-Object` (PowerShell) or `for` loops (Bash) +5. **Verify dimensions first** - Check image dimensions before processing to avoid unnecessary operations +6. **Use appropriate resize flags** - Consider using `!` to force exact dimensions or `^` for minimum dimensions + +## Common Patterns + +### PowerShell Patterns + +#### Pattern: Store ImageMagick Path + +```powershell +$magick = (Get-Command magick).Source +``` + +#### Pattern: Get Dimensions as Variables + +```powershell +$dimensions = & $magick identify -format "%w,%h" $_.FullName +$width,$height = $dimensions -split ',' +``` + +#### Pattern: Conditional Processing + +```powershell +if ([int]$width -gt 1920) { + & $magick $_.FullName -resize 1920x1080 $outputPath +} +``` + +#### Pattern: Create Thumbnails + +```powershell +& $magick $_.FullName -resize 427x240 "thumbnails/thumb_$($_.Name)" +``` + +### Bash Patterns + +#### Pattern: Check ImageMagick Installation + +```bash +command -v magick &> /dev/null || { echo "ImageMagick required"; exit 1; } +``` + +#### Pattern: Get Dimensions as Variables + +```bash +dimensions=$(magick identify -format "%w,%h" "$img") +width=$(echo "$dimensions" | cut -d',' -f1) +height=$(echo "$dimensions" | cut -d',' -f2) +``` + +#### Pattern: Conditional Processing + +```bash +if [[ "$width" -gt 1920 ]]; then + magick "$img" -resize 1920x1080 "$outputPath" +fi +``` + +#### Pattern: Create Thumbnails + +```bash +filename=$(basename "$img") +magick "$img" -resize 427x240 "thumbnails/thumb_$filename" +``` + +## Limitations + +- Large batch operations may be memory-intensive +- Some complex operations may require additional ImageMagick delegates +- On older Linux systems, use `convert` instead of `magick` (ImageMagick 6.x vs 7.x) From 920bc3b47cd959b00c5d92bb0a3cb20e77c27072 Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Sat, 20 Dec 2025 11:18:12 -0800 Subject: [PATCH 2/5] add desc --- docs/README.skills.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/README.skills.md b/docs/README.skills.md index 8c2876521..f5a3d54fb 100644 --- a/docs/README.skills.md +++ b/docs/README.skills.md @@ -22,4 +22,5 @@ Skills differ from other primitives by supporting bundled assets (scripts, code | Name | Description | Bundled Assets | | ---- | ----------- | -------------- | +| [image-manipulation-image-magick](../skills/image-manipulation-image-magick/SKILL.md) | 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. | none | | [webapp-testing](../skills/webapp-testing/SKILL.md) | Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs. | `test-helper.js` | From 427c9c96b73f13f370498a29f628a52af562adf9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 21 Jan 2026 16:43:47 +0000 Subject: [PATCH 3/5] Initial plan From 5f1f55f571bfd2cd23c6129763e64184b237142e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 21 Jan 2026 16:48:38 +0000 Subject: [PATCH 4/5] Fix skill name mismatch - update name to match folder Co-authored-by: jamesmontemagno <1676321+jamesmontemagno@users.noreply.github.com> --- docs/README.skills.md | 2 +- skills/image-manipulation-image-magick/SKILL.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/README.skills.md b/docs/README.skills.md index f5a3d54fb..fc927e235 100644 --- a/docs/README.skills.md +++ b/docs/README.skills.md @@ -22,5 +22,5 @@ Skills differ from other primitives by supporting bundled assets (scripts, code | Name | Description | Bundled Assets | | ---- | ----------- | -------------- | -| [image-manipulation-image-magick](../skills/image-manipulation-image-magick/SKILL.md) | 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. | none | +| [image-manipulation-image-magick](../skills/image-manipulation-image-magick/SKILL.md) | 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. | None | | [webapp-testing](../skills/webapp-testing/SKILL.md) | Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs. | `test-helper.js` | diff --git a/skills/image-manipulation-image-magick/SKILL.md b/skills/image-manipulation-image-magick/SKILL.md index 9f56b79f5..dfa17add1 100644 --- a/skills/image-manipulation-image-magick/SKILL.md +++ b/skills/image-manipulation-image-magick/SKILL.md @@ -1,5 +1,5 @@ --- -name: image-manipulation +name: image-manipulation-image-magick description: 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. compatibility: Requires ImageMagick installed and available as `magick` on PATH. Cross-platform examples provided for PowerShell (Windows) and Bash (Linux/macOS). --- From 0d3f3dfc9ec0b4c5760b267a36a15a60dd6e415b Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Wed, 21 Jan 2026 17:43:16 +0000 Subject: [PATCH 5/5] Remove empty line in skills table for improved formatting --- docs/README.skills.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/README.skills.md b/docs/README.skills.md index 7a43b5717..832f5bdaa 100644 --- a/docs/README.skills.md +++ b/docs/README.skills.md @@ -22,7 +22,6 @@ Skills differ from other primitives by supporting bundled assets (scripts, code | Name | Description | Bundled Assets | | ---- | ----------- | -------------- | - | [appinsights-instrumentation](../skills/appinsights-instrumentation/SKILL.md) | Instrument a webapp to send useful telemetry data to Azure App Insights | `LICENSE.txt`
`examples/appinsights.bicep`
`references/ASPNETCORE.md`
`references/AUTO.md`
`references/NODEJS.md`
`references/PYTHON.md`
`scripts/appinsights.ps1` | | [azure-resource-visualizer](../skills/azure-resource-visualizer/SKILL.md) | Analyze Azure resource groups and generate detailed Mermaid architecture diagrams showing the relationships between individual resources. Use this skill when the user asks for a diagram of their Azure resources or help in understanding how the resources relate to each other. | `LICENSE.txt`
`assets/template-architecture.md` | | [azure-role-selector](../skills/azure-role-selector/SKILL.md) | When user is asking for guidance for which role to assign to an identity given desired permissions, this agent helps them understand the role that will meet the requirements with least privilege access and how to apply that role. | `LICENSE.txt` |