Image Handler
Analyze, convert, and manipulate image files.
Supported Formats
Format Extensions Read Convert Metadata PNG .png ✅ ✅ ✅ JPEG
.jpg, .jpeg | ✅ | ✅ | ✅ |
| GIF | .gif | ✅ | ✅ | ✅ |
| WebP | .webp | ✅ | ✅ | ✅ |
| TIFF | .tiff, .tif | ✅ | ✅ | ✅ |
| BMP | .bmp | ✅ | ✅ | ✅ |
| HEIC | .heic, .heif | ✅ | ✅ | ✅ |
| SVG | .svg | ✅ | ✅ | - |
| ICO | .ico | ✅ | ✅ | ✅ |
Quick Commands
Metadata (sips - built-in macOS)
CODEBLOCK0
Convert Formats
CODEBLOCK1
Resize
CODEBLOCK2
Rotate & Flip
CODEBLOCK3
Crop
CODEBLOCK4
Strip Metadata
CODEBLOCK5
ffmpeg (advanced operations)
CODEBLOCK6
Scripts
image_info.sh
Get comprehensive image metadata.
CODEBLOCK7
convert_image.sh
Convert between formats with options.
CODEBLOCK8
batch_convert.sh
Convert all images in a directory.
CODEBLOCK9
Workflow
1. Get info — sips -g all for dimensions, format, metadata Convert if needed — Change format for compatibilityResize/optimize — Reduce file size for web/sharingStrip metadata — Remove EXIF for privacy
Notes
- sips is built into macOS — no installation needed INLINECODE2 handles WebP, animated GIFs, and video-to-image For HEIC (iPhone photos), convert to JPEG for compatibility SVG is text-based — use cat or text tools For OCR on images, use the document-handler skill
图像处理器
分析、转换和操作图像文件。
支持的格式
格式 扩展名 读取 转换 元数据 PNG .png ✅ ✅ ✅ JPEG
.jpg, .jpeg | ✅ | ✅ | ✅ |
| GIF | .gif | ✅ | ✅ | ✅ |
| WebP | .webp | ✅ | ✅ | ✅ |
| TIFF | .tiff, .tif | ✅ | ✅ | ✅ |
| BMP | .bmp | ✅ | ✅ | ✅ |
| HEIC | .heic, .heif | ✅ | ✅ | ✅ |
| SVG | .svg | ✅ | ✅ | - |
| ICO | .ico | ✅ | ✅ | ✅ |
快速命令
元数据(sips - macOS 内置)
bash
获取所有属性
sips -g all image.jpg
获取特定属性
sips -g pixelWidth -g pixelHeight -g format -g dpiWidth -g dpiHeight image.jpg
类 JSON 输出(可解析)
sips -g all image.jpg 2>&1 | tail +2
格式转换
bash
转换为 PNG
sips -s format png input.jpg --out output.png
转换为 JPEG 并设置质量
sips -s format jpeg -s formatOptions 85 input.png --out output.jpg
将 HEIC 转换为 JPEG
sips -s format jpeg input.heic --out output.jpg
批量转换(shell)
for f in *.heic; do sips -s format jpeg $f --out ${f%.heic}.jpg; done
调整大小
bash
按最大尺寸调整(保持宽高比)
sips --resampleWidth 1920 image.jpg --out resized.jpg
sips --resampleHeight 1080 image.jpg --out resized.jpg
按精确尺寸调整
sips --resampleWidth 1920 --resampleHeight 1080 image.jpg --out resized.jpg
按百分比缩放
sips --resampleWidth 50% image.jpg --out half.jpg
旋转与翻转
bash
顺时针旋转 90 度
sips --rotate 90 image.jpg --out rotated.jpg
旋转 180 度
sips --rotate 180 image.jpg --out rotated.jpg
水平翻转
sips --flip horizontal image.jpg --out flipped.jpg
垂直翻转
sips --flip vertical image.jpg --out flipped.jpg
裁剪
bash
按指定像素裁剪(x, y, 宽度, 高度)
sips --cropToHeightWidth 500 500 image.jpg --out cropped.jpg
从中心裁剪
sips --cropToHeightWidth 500 500 --cropOffset 100 100 image.jpg --out cropped.jpg
剥离元数据
bash
移除 EXIF 和所有元数据
sips --deleteProperty all image.jpg --out clean.jpg
ffmpeg(高级操作)
bash
WebP 转 PNG
ffmpeg -i input.webp output.png
从 GIF 提取帧
ffmpeg -i animation.gif frame_%03d.png
从图片创建 GIF
ffmpeg -framerate 10 -i frame_%03d.png output.gif
使用 ffmpeg 调整大小
ffmpeg -i input.jpg -vf scale=1920:-1 output.jpg
视频转 GIF
ffmpeg -i video.mp4 -vf fps=10,scale=480:-1 output.gif
脚本
image_info.sh
获取全面的图像元数据。
bash
~/Dropbox/jarvis/skills/image-handler/scripts/image_info.sh
convert_image.sh
在格式间转换并附带选项。
bash
~/Dropbox/jarvis/skills/image-handler/scripts/convert_image.sh [quality]
batch_convert.sh
转换目录中的所有图像。
bash
~/Dropbox/jarvis/skills/image-handler/scripts/batchconvert.sh dir> format> [output dir]
工作流程
1. 获取信息 — sips -g all 获取尺寸、格式、元数据 按需转换 — 更改格式以确保兼容性调整/优化 — 减小文件大小以便于网页/分享剥离元数据 — 移除 EXIF 以保护隐私
备注
- sips 内置于 macOS — 无需安装 ffmpeg 处理 WebP、动画 GIF 和视频转图像 对于 HEIC(iPhone 照片),转换为 JPEG 以确保兼容性 SVG 基于文本 — 使用 cat 或文本工具 如需对图像进行 OCR,请使用文档处理器技能