Image
生成和处理图像内容的基础功能模块
Core functionality module for generating and processing image content
clawhub install image使用 ImageMagick 进行高级图像处理和编辑。
name: image-manipulation-image-magick
# 安装 Skill npx skills add github/awesome-copilot@image-manipulation-image-magick # 安装后 Claude Code 会自动识别并使用
# 同样的安装命令,兼容所有支持 SKILL.md 的 AI 编程工具 npx skills add github/awesome-copilot@image-manipulation-image-magick
完全本地开源工具,基于ImageMagick,无需API密钥
magick (or at C:\Program Files\ImageMagick-*\magick.exe)apt, brew, etc.)magick executable# 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."
}
# 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
# 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%hn" $_.FullName
Write-Host $dimensions
}
# 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
# 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)"
}
# 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
# Get verbose information about an image
& $magick identify -verbose path/to/image.jpg
# Get verbose information about an image
magick identify -verbose path/to/image.jpg
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)"
}
}
}
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 for cleaner code (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"
instead of magick` (ImageMagick 6.x vs 7.x)npx skills add github/awesome-copilot@image-manipulation-image-magick && skills image-manipulation --input "input.png" --resize "1200x800" --quality 90 --output "resized.png"图像托管:将图像上传到 img402.dev 获取公开链接,用于消息分享、文档嵌入或社交媒体发布。
Upload images to img402.dev and get a public URL. Free tier: 1MB max, 7-day retention, no auth. Use when the agent needs a hosted image URL — for sharing in messages, embedding in documents, posting to social platforms, or any context that requires a public link to an image file.
clawhub install image-hosting