image-tools
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImage Tools Skill
图片工具技能
Image analysis and manipulation tools.
图片分析与处理工具。
When to Use
适用场景
- Extract image metadata (EXIF, dimensions, format)
- Convert between image formats
- Resize or crop images
- Analyze image content
- Get image information
- 提取图片元数据(EXIF、尺寸、格式)
- 转换图片格式
- 调整图片尺寸或裁剪图片
- 分析图片内容
- 获取图片信息
Image Information
图片信息
Get Image Details
获取图片详情
bash
undefinedbash
undefinedUsing file command
Using file command
file image.jpg
file image.jpg
Using identify (ImageMagick)
Using identify (ImageMagick)
identify -verbose image.jpg
identify -verbose image.jpg
Get dimensions
Get dimensions
identify -format "%wx%h" image.jpg
identify -format "%wx%h" image.jpg
Get EXIF data
Get EXIF data
identify -format "%[EXIF:*]" image.jpg
undefinedidentify -format "%[EXIF:*]" image.jpg
undefinedQuick Info Script
快速信息脚本
bash
#!/bin/bashbash
#!/bin/bashGet basic image info
Get basic image info
FILE="$1"
if [ -z "$FILE" ]; then
echo "Usage: $0 <image-file>"
exit 1
fi
echo "=== Image Info ==="
file "$FILE"
echo ""
echo "Dimensions:"
identify -format "%wx%h\n" "$FILE"
echo ""
echo "Format:"
identify -format "%m\n" "$FILE"
undefinedFILE="$1"
if [ -z "$FILE" ]; then
echo "Usage: $0 <image-file>"
exit 1
fi
echo "=== Image Info ==="
file "$FILE"
echo ""
echo "Dimensions:"
identify -format "%wx%h\n" "$FILE"
echo ""
echo "Format:"
identify -format "%m\n" "$FILE"
undefinedImage Conversion
图片转换
Convert Formats
格式转换
bash
undefinedbash
undefinedPNG to JPEG
PNG to JPEG
convert input.png output.jpg
convert input.png output.jpg
JPEG to PNG
JPEG to PNG
convert input.jpg output.png
convert input.jpg output.png
Convert to grayscale
Convert to grayscale
convert input.jpg -colorspace Gray output.jpg
convert input.jpg -colorspace Gray output.jpg
Resize
Resize
convert input.jpg -resize 800x600 output.jpg
convert input.jpg -resize 50% output.jpg
undefinedconvert input.jpg -resize 800x600 output.jpg
convert input.jpg -resize 50% output.jpg
undefinedWebP Conversion
WebP格式转换
bash
undefinedbash
undefinedJPEG to WebP
JPEG to WebP
cwebp input.jpg -o output.webp
cwebp input.jpg -o output.webp
PNG to WebP
PNG to WebP
cwebp -lossless input.png -o output.webp
undefinedcwebp -lossless input.png -o output.webp
undefinedImage Analysis
图片分析
Count Colors
统计颜色数量
bash
undefinedbash
undefinedUnique colors in image
Unique colors in image
identify -format "%k" input.jpg
undefinedidentify -format "%k" input.jpg
undefinedImage Histogram
图片直方图
bash
undefinedbash
undefinedGet color histogram
Get color histogram
convert input.jpg -format %c histogram:info:-
convert input.jpg -format %c histogram:info:-
Simple histogram
Simple histogram
identify -verbose input.jpg | grep -A 100 "Histogram:"
undefinedidentify -verbose input.jpg | grep -A 100 "Histogram:"
undefinedOCR (Text Extraction)
OCR(文本提取)
bash
undefinedbash
undefinedExtract text from image
Extract text from image
tesseract image.jpg stdout
tesseract image.jpg stdout
Specific language
Specific language
tesseract image.jpg stdout -l eng
undefinedtesseract image.jpg stdout -l eng
undefinedScreenshots
截图工具
Capture Screen
捕获屏幕
bash
undefinedbash
undefinedFull screen (Linux)
Full screen (Linux)
import -window root screenshot.png
import -window root screenshot.png
Region selection
Region selection
import screenshot.png
import screenshot.png
Using scrot (if installed)
Using scrot (if installed)
scrot -s selection.png
undefinedscrot -s selection.png
undefinedCapture URL as Image
捕获网页为图片
bash
undefinedbash
undefinedUsing wkhtmltoimage
Using wkhtmltoimage
wkhtmltoimage https://example.com page.png
wkhtmltoimage https://example.com page.png
Using chromium headless
Using chromium headless
chromium --headless --screenshot=output.png https://example.com
undefinedchromium --headless --screenshot=output.png https://example.com
undefinedUseful Tools
实用工具列表
| Tool | Purpose |
|---|---|
| Detect file type |
| Get image metadata |
| Format conversion, resize |
| Blend images |
| Create image grids |
| OCR text extraction |
| 工具 | 用途 |
|---|---|
| 检测文件类型 |
| 获取图片元数据 |
| 格式转换、尺寸调整 |
| 图片混合 |
| 创建图片网格 |
| OCR文本提取 |
Examples
使用示例
Check if image is valid:
bash
file image.jpg && identify image.jpg >/dev/null 2>&1 && echo "Valid image"Batch resize:
bash
for f in *.jpg; do convert "$f" -resize 800x600 "thumb_$f"; doneExtract thumbnail:
bash
convert input.jpg -thumbnail 200x200^ -gravity center -extent 200x200 thumb.jpg检查图片是否有效:
bash
file image.jpg && identify image.jpg >/dev/null 2>&1 && echo "Valid image"批量调整尺寸:
bash
for f in *.jpg; do convert "$f" -resize 800x600 "thumb_$f"; done提取缩略图:
bash
convert input.jpg -thumbnail 200x200^ -gravity center -extent 200x200 thumb.jpg