image-manipulation-image-magick by github/awesome-copilot
npx skills add https://github.com/github/awesome-copilot --skill image-manipulation-image-magick此技能支持在 Windows、Linux 和 macOS 系统上使用 ImageMagick 执行图像处理和操作任务。
当您需要执行以下操作时,请使用此技能:
magick(或位于 C:\Program Files\ImageMagick-*\magick.exe)apt、brew 等)安装了 ImageMagick 的 Bash广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
magick 可执行文件PowerShell (Windows):
# 优先使用 PATH 上的 ImageMagick
$magick = (Get-Command magick -ErrorAction SilentlyContinue)?.Source
# 备用方案: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。请安装它和/或将 'magick' 添加到 PATH。"
}
Bash (Linux/macOS):
# 检查 magick 是否在 PATH 上可用
if ! command -v magick &> /dev/null; then
echo "未找到 ImageMagick。请使用您的包管理器安装:"
echo " Ubuntu/Debian: sudo apt install imagemagick"
echo " macOS: brew install imagemagick"
exit 1
fi
PowerShell (Windows):
# 对于单张图像
& $magick identify -format "%wx%h" path/to/image.jpg
# 对于多张图像
Get-ChildItem "path/to/images/*" | ForEach-Object {
$dimensions = & $magick identify -format "%f: %wx%h`n" $_.FullName
Write-Host $dimensions
}
Bash (Linux/macOS):
# 对于单张图像
magick identify -format "%wx%h" path/to/image.jpg
# 对于多张图像
for img in path/to/images/*; do
magick identify -format "%f: %wx%h\n" "$img"
done
PowerShell (Windows):
# 调整单张图像大小
& $magick input.jpg -resize 427x240 output.jpg
# 批量调整图像大小
Get-ChildItem "path/to/images/*" | ForEach-Object {
& $magick $_.FullName -resize 427x240 "path/to/output/thumb_$($_.Name)"
}
Bash (Linux/macOS):
# 调整单张图像大小
magick input.jpg -resize 427x240 output.jpg
# 批量调整图像大小
for img in path/to/images/*; do
filename=$(basename "$img")
magick "$img" -resize 427x240 "path/to/output/thumb_$filename"
done
PowerShell (Windows):
# 获取图像的详细信息
& $magick identify -verbose path/to/image.jpg
Bash (Linux/macOS):
# 获取图像的详细信息
magick identify -verbose path/to/image.jpg
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 "正在处理 $($_.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 "正在处理 $filename"
magick "$img" -resize 427x240 "path/to/output/thumb_$filename"
fi
fi
done
& 操作符 (PowerShell) - 在 PowerShell 中使用 & 调用 magick 可执行文件$magick 以使代码更清晰ForEach-Object (PowerShell) 或 for 循环 (Bash)! 强制精确尺寸或使用 ^ 表示最小尺寸$magick = (Get-Command magick).Source
$dimensions = & $magick identify -format "%w,%h" $_.FullName
$width,$height = $dimensions -split ','
if ([int]$width -gt 1920) {
& $magick $_.FullName -resize 1920x1080 $outputPath
}
& $magick $_.FullName -resize 427x240 "thumbnails/thumb_$($_.Name)"
command -v magick &> /dev/null || { echo "需要 ImageMagick"; exit 1; }
dimensions=$(magick identify -format "%w,%h" "$img")
width=$(echo "$dimensions" | cut -d',' -f1)
height=$(echo "$dimensions" | cut -d',' -f2)
if [[ "$width" -gt 1920 ]]; then
magick "$img" -resize 1920x1080 "$outputPath"
fi
filename=$(basename "$img")
magick "$img" -resize 427x240 "thumbnails/thumb_$filename"
convert 而不是 magick(ImageMagick 6.x 与 7.x)每周安装量
7.6K
仓库
GitHub 星标数
26.7K
首次出现
Jan 22, 2026
安全审计
安装于
codex7.5K
gemini-cli7.5K
opencode7.5K
github-copilot7.4K
cursor7.4K
amp7.4K
This skill enables image processing and manipulation tasks using ImageMagick across Windows, Linux, and macOS systems.
Use this skill when you need to:
magick (or at C:\Program Files\ImageMagick-*\magick.exe)apt, brew, etc.)magick executablePowerShell (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
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
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
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
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
& operator (PowerShell) - Invoke the magick executable using & in PowerShell$magick for cleaner codeForEach-Object (PowerShell) or for loops (Bash)! to force exact dimensions or ^ for minimum dimensions$magick = (Get-Command magick).Source
$dimensions = & $magick identify -format "%w,%h" $_.FullName
$width,$height = $dimensions -split ','
if ([int]$width -gt 1920) {
& $magick $_.FullName -resize 1920x1080 $outputPath
}
& $magick $_.FullName -resize 427x240 "thumbnails/thumb_$($_.Name)"
command -v magick &> /dev/null || { echo "ImageMagick required"; exit 1; }
dimensions=$(magick identify -format "%w,%h" "$img")
width=$(echo "$dimensions" | cut -d',' -f1)
height=$(echo "$dimensions" | cut -d',' -f2)
if [[ "$width" -gt 1920 ]]; then
magick "$img" -resize 1920x1080 "$outputPath"
fi
filename=$(basename "$img")
magick "$img" -resize 427x240 "thumbnails/thumb_$filename"
convert instead of magick (ImageMagick 6.x vs 7.x)Weekly Installs
7.6K
Repository
GitHub Stars
26.7K
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex7.5K
gemini-cli7.5K
opencode7.5K
github-copilot7.4K
cursor7.4K
amp7.4K
97,600 周安装