image-manipulation-image-magickद्वारा github

Image processing and manipulation using ImageMagick across Windows, Linux, and macOS. Retrieve image metadata, dimensions, and format information with the identify command Resize single or batch images with aspect ratio control and thumbnail generation Filter and process images based on dimensions or file type criteria Requires ImageMagick installed and available as magick on PATH; includes platform-specific setup for PowerShell (Windows) and Bash (Linux/macOS)

npx skills add https://github.com/github/awesome-copilot --skill image-manipulation-image-magick

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

Example 2: Resize Images

PowerShell (Windows):

# 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):

# 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):

# Get verbose information about an image
& $magick identify -verbose path/to/image.jpg

Bash (Linux/macOS):

# Get verbose information about an image
magick identify -verbose path/to/image.jpg

Example 4: Process Images Based on Dimensions

PowerShell (Windows):

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):

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

$magick = (Get-Command magick).Source

Pattern: Get Dimensions as Variables

$dimensions = & $magick identify -format "%w,%h" $_.FullName
$width,$height = $dimensions -split ','

Pattern: Conditional Processing

if ([int]$width -gt 1920) {
    & $magick $_.FullName -resize 1920x1080 $outputPath
}

Pattern: Create Thumbnails

& $magick $_.FullName -resize 427x240 "thumbnails/thumb_$($_.Name)"

Bash Patterns

Pattern: Check ImageMagick Installation

command -v magick &> /dev/null || { echo "ImageMagick required"; exit 1; }

Pattern: Get Dimensions as Variables

dimensions=$(magick identify -format "%w,%h" "$img")
width=$(echo "$dimensions" | cut -d',' -f1)
height=$(echo "$dimensions" | cut -d',' -f2)

Pattern: Conditional Processing

if [[ "$width" -gt 1920 ]]; then
    magick "$img" -resize 1920x1080 "$outputPath"
fi

Pattern: Create Thumbnails

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)

github की और Skills

console-rendering
by github
Instructions for using the struct tag-based console rendering system in Go
acquire-codebase-knowledge
by github
Use this skill when the user explicitly asks to map, document, or onboard into an existing codebase. Trigger for prompts like "map this codebase", "document…
acreadiness-assess
by github
Run the AgentRC readiness assessment on the current repository and produce a static HTML dashboard at reports/index.html. Wraps `npx github:microsoft/agentrc…
acreadiness-generate-instructions
by github
Generate tailored AI agent instruction files via AgentRC instructions command. Produces .github/copilot-instructions.md (default, recommended for Copilot in VS…
acreadiness-policy
by github
Help the user pick, write, or apply an AgentRC policy. Policies customise readiness scoring by disabling irrelevant checks, overriding impact/level, setting…
add-educational-comments
by github
Add educational comments to code files to transform them into effective learning resources. Adapts explanation depth and tone to three configurable knowledge levels: beginner, intermediate, and advanced Automatically requests a file if none is provided, with numbered list matching for quick selection Expands files by up to 125% using educational comments only (hard limit: 400 new lines; 300 for files over 1,000 lines) Preserves file encoding, indentation style, syntax correctness, and...
adobe-illustrator-scripting
by github
Write, debug, and optimize Adobe Illustrator automation scripts using ExtendScript (JavaScript/JSX). Use when creating or modifying scripts that manipulate…
agent-governance
by github
Declarative policies, intent classification, and audit trails for controlling AI agent tool access and behavior. Composable governance policies define allowed/blocked tools, content filters, rate limits, and approval requirements — stored as configuration, not code Semantic intent classification detects dangerous prompts (data exfiltration, privilege escalation, prompt injection) before tool execution using pattern-based signals Tool-level governance decorator enforces policies at function...

NotebookLM Web Importer

एक क्लिक में वेब पेज और YouTube वीडियो NotebookLM में आयात करें। 200,000+ उपयोगकर्ताओं द्वारा विश्वसनीय।

Chrome एक्सटेंशन इंस्टॉल करें