gimp-inkscape
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGIMP + Inkscape + ImageMagick Image Skill
GIMP + Inkscape + ImageMagick 图像处理技能
Local image creation and manipulation. No API calls, no cost, no internet required.
本地图像创建与处理。无需调用API,无成本,无需联网。
Decision Guide — Pick the Right Tool
决策指南——选择合适的工具
| Task | Use | Notes |
|---|---|---|
| Simple resize | ImageMagick | 10× faster than GIMP, one liner |
| Batch resize folder | ImageMagick mogrify | Purpose-built for batch |
| SVG → PNG | Inkscape | Vector quality, exact dimensions |
| Text overlay / watermark | ImageMagick | Reliable; GIMP Script-Fu text is flaky |
| Complex typography | Inkscape SVG | Pixel-perfect vector text |
| Format conversion | ImageMagick | One liner, handles WebP too |
| Compositing / layers | GIMP | Full layer control |
| Color correction | GIMP | Curves/levels more precise than IM |
| PNG compression | OptiPNG | Lossless, 20–50% savings |
| JPEG compression | jpegoptim | Lossless recompression |
| Metadata read/strip | ExifTool | The industry standard |
| GIF / animation | FFmpeg | Nothing else handles this |
| PDF → image | pdftoppm | Clean, DPI-controllable |
| Photo editing (advanced) | GIMP | Healing, clone stamp, curves |
| 任务 | 使用工具 | 说明 |
|---|---|---|
| 简单调整大小 | ImageMagick | 比GIMP快10倍,单行命令即可完成 |
| 批量调整文件夹内图片大小 | ImageMagick mogrify | 专为批量处理设计 |
| SVG → PNG | Inkscape | 矢量画质,精确尺寸 |
| 文本叠加 / 水印 | ImageMagick | 可靠;GIMP Script-Fu文本功能不稳定 |
| 复杂排版 | Inkscape SVG | 像素级精准的矢量文本 |
| 格式转换 | ImageMagick | 单行命令,支持WebP格式 |
| 图像合成 / 图层处理 | GIMP | 完整的图层控制 |
| 色彩校正 | GIMP | 曲线/色阶比ImageMagick更精准 |
| PNG压缩 | OptiPNG | 无损压缩,可节省20–50%空间 |
| JPEG压缩 | jpegoptim | 无损重新压缩 |
| 元数据读取/清除 | ExifTool | 行业标准工具 |
| GIF / 动画制作 | FFmpeg | 其他工具无法替代 |
| PDF → 图像 | pdftoppm | 输出清晰,可控制DPI |
| 高级照片编辑 | GIMP | 修复、仿制图章、曲线调整等功能 |
Optional installs for two specific tasks
两项特定任务的可选安装
- Background removal: then
pip install rembgrembg i input.png output.png - AI upscaling: Real-ESRGAN — significant quality boost over interpolation upscaling
- 背景移除:然后执行
pip install rembgrembg i input.png output.png - AI图像放大:Real-ESRGAN — 比插值放大的画质提升显著
ImageMagick — CLI Reference
ImageMagick — CLI 参考
Format conversion
格式转换
bash
convert input.png output.jpg
convert input.jpg output.webp
convert input.png -quality 92 output.jpgbash
convert input.png output.jpg
convert input.jpg output.webp
convert input.png -quality 92 output.jpgResize
调整大小
bash
undefinedbash
undefinedExact dimensions (may distort)
精确尺寸(可能会变形)
convert input.jpg -resize 1200x630! output.jpg
convert input.jpg -resize 1200x630! output.jpg
Fit within box (preserves aspect ratio)
适配指定尺寸框(保持宽高比)
convert input.jpg -resize 1200x630 output.jpg
convert input.jpg -resize 1200x630 output.jpg
Fill and crop to exact dimensions (centered)
填充并裁剪至精确尺寸(居中)
convert input.jpg -resize 1200x630^ -gravity Center -extent 1200x630 output.jpg
undefinedconvert input.jpg -resize 1200x630^ -gravity Center -extent 1200x630 output.jpg
undefinedBatch resize entire folder (mogrify)
批量调整整个文件夹内图片大小(mogrify)
bash
undefinedbash
undefinedResize all JPEGs in place
原地调整所有JPEG图片大小
mogrify -resize 800x600 /path/to/folder/*.jpg
mogrify -resize 800x600 /path/to/folder/*.jpg
Resize and output to a different folder
调整大小并输出到另一个文件夹
mogrify -resize 800x600 -path /output/folder /input/folder/*.jpg
mogrify -resize 800x600 -path /output/folder /input/folder/*.jpg
Convert all PNGs to WebP
将所有PNG转换为WebP格式
mogrify -format webp /path/to/folder/*.png
undefinedmogrify -format webp /path/to/folder/*.png
undefinedText overlay / watermark
文本叠加 / 水印
bash
undefinedbash
undefinedSimple text in bottom-right corner
右下角添加简单文本
convert input.jpg
-font DejaVu-Sans -pointsize 36
-fill white -annotate +20+40 "© ReshareAI"
output.jpg
-font DejaVu-Sans -pointsize 36
-fill white -annotate +20+40 "© ReshareAI"
output.jpg
convert input.jpg
-font DejaVu-Sans -pointsize 36
-fill white -annotate +20+40 "© ReshareAI"
output.jpg
-font DejaVu-Sans -pointsize 36
-fill white -annotate +20+40 "© ReshareAI"
output.jpg
Centered text with shadow
居中带阴影文本
convert input.jpg
-font DejaVu-Sans-Bold -pointsize 72
-fill black -annotate +202+302 "Headline"
-fill white -annotate +200+300 "Headline"
output.jpg
-font DejaVu-Sans-Bold -pointsize 72
-fill black -annotate +202+302 "Headline"
-fill white -annotate +200+300 "Headline"
output.jpg
convert input.jpg
-font DejaVu-Sans-Bold -pointsize 72
-fill black -annotate +202+302 "Headline"
-fill white -annotate +200+300 "Headline"
output.jpg
-font DejaVu-Sans-Bold -pointsize 72
-fill black -annotate +202+302 "Headline"
-fill white -annotate +200+300 "Headline"
output.jpg
Semi-transparent watermark tiled across image
半透明水印平铺整个图像
convert input.jpg
-font DejaVu-Sans -pointsize 48 -fill "rgba(255,255,255,0.3)"
-gravity Center -annotate 30x30+0+0 "WATERMARK"
output.jpg
-font DejaVu-Sans -pointsize 48 -fill "rgba(255,255,255,0.3)"
-gravity Center -annotate 30x30+0+0 "WATERMARK"
output.jpg
undefinedconvert input.jpg
-font DejaVu-Sans -pointsize 48 -fill "rgba(255,255,255,0.3)"
-gravity Center -annotate 30x30+0+0 "WATERMARK"
output.jpg
-font DejaVu-Sans -pointsize 48 -fill "rgba(255,255,255,0.3)"
-gravity Center -annotate 30x30+0+0 "WATERMARK"
output.jpg
undefinedComposite: place logo/image on top
图像合成:将徽标/图片叠加在上方
bash
undefinedbash
undefinedPlace logo.png bottom-right with 10px padding
将logo.png放在右下角,保留10px边距
convert base.jpg
logo.png
-gravity SouthEast -geometry +10+10
-composite output.jpg
logo.png
-gravity SouthEast -geometry +10+10
-composite output.jpg
convert base.jpg
logo.png
-gravity SouthEast -geometry +10+10
-composite output.jpg
logo.png
-gravity SouthEast -geometry +10+10
-composite output.jpg
Place with opacity
带透明度的叠加
convert base.jpg
( logo.png -alpha set -channel Alpha -evaluate multiply 0.5 )
-gravity Center -composite output.jpg
( logo.png -alpha set -channel Alpha -evaluate multiply 0.5 )
-gravity Center -composite output.jpg
undefinedconvert base.jpg
( logo.png -alpha set -channel Alpha -evaluate multiply 0.5 )
-gravity Center -composite output.jpg
( logo.png -alpha set -channel Alpha -evaluate multiply 0.5 )
-gravity Center -composite output.jpg
undefinedColor adjustments
色彩调整
bash
undefinedbash
undefinedBrightness / contrast
亮度 / 对比度
convert input.jpg -brightness-contrast 10x20 output.jpg
convert input.jpg -brightness-contrast 10x20 output.jpg
Saturation
饱和度
convert input.jpg -modulate 100,130,100 output.jpg
convert input.jpg -modulate 100,130,100 output.jpg
Grayscale
灰度化
convert input.jpg -colorspace Gray output.jpg
convert input.jpg -colorspace Gray output.jpg
Sharpen
锐化
convert input.jpg -unsharp 0x1 output.jpg
undefinedconvert input.jpg -unsharp 0x1 output.jpg
undefinedGet image info
获取图像信息
bash
identify input.jpg
identify -verbose input.jpg | grep -E "Geometry|Colorspace|Format|filesize"bash
identify input.jpg
identify -verbose input.jpg | grep -E "Geometry|Colorspace|Format|filesize"ImageMagick — WebP
ImageMagick — WebP 处理
ImageMagick has the WebP delegate built in (confirmed on this system):
bash
undefined当前系统已内置ImageMagick的WebP处理插件:
bash
undefinedPNG/JPEG → WebP
PNG/JPEG → WebP
convert input.png -quality 85 output.webp
convert input.png -quality 85 output.webp
WebP → PNG
WebP → PNG
convert input.webp output.png
convert input.webp output.png
Batch convert all JPEGs to WebP
批量将所有JPEG转换为WebP
mogrify -format webp -quality 85 /path/to/folder/*.jpg
---mogrify -format webp -quality 85 /path/to/folder/*.jpg
---FFmpeg — GIF & Animation
FFmpeg — GIF & 动画制作
Video → GIF
视频 → GIF
bash
undefinedbash
undefinedBasic
基础转换
ffmpeg -i input.mp4 -vf "fps=10,scale=800:-1" output.gif
ffmpeg -i input.mp4 -vf "fps=10,scale=800:-1" output.gif
High quality (uses palette)
高质量转换(使用调色板)
ffmpeg -i input.mp4 -vf "fps=12,scale=800:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i input.mp4 -i palette.png -vf "fps=12,scale=800:-1:flags=lanczos,paletteuse" output.gif
ffmpeg -i input.mp4 -vf "fps=12,scale=800:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i input.mp4 -i palette.png -vf "fps=12,scale=800:-1:flags=lanczos,paletteuse" output.gif
Clip a section (start 5s, duration 3s)
截取片段(从第5秒开始,时长3秒)
ffmpeg -ss 5 -t 3 -i input.mp4 -vf "fps=10,scale=600:-1" output.gif
undefinedffmpeg -ss 5 -t 3 -i input.mp4 -vf "fps=10,scale=600:-1" output.gif
undefinedExtract frames from video
从视频提取帧
bash
undefinedbash
undefinedExtract every frame as PNG
提取所有帧为PNG
ffmpeg -i input.mp4 /output/frame_%04d.png
ffmpeg -i input.mp4 /output/frame_%04d.png
Extract 1 frame per second
每秒提取1帧
ffmpeg -i input.mp4 -vf fps=1 /output/frame_%04d.png
ffmpeg -i input.mp4 -vf fps=1 /output/frame_%04d.png
Extract a single frame at timestamp
在指定时间戳提取单帧
ffmpeg -ss 00:00:05 -i input.mp4 -frames:v 1 output.png
undefinedffmpeg -ss 00:00:05 -i input.mp4 -frames:v 1 output.png
undefinedImage sequence → video or GIF
图像序列 → 视频或GIF
bash
undefinedbash
undefinedFrames → MP4
帧序列 → MP4
ffmpeg -framerate 24 -i frame_%04d.png -c:v libx264 output.mp4
ffmpeg -framerate 24 -i frame_%04d.png -c:v libx264 output.mp4
Frames → GIF
帧序列 → GIF
ffmpeg -framerate 10 -i frame_%04d.png output.gif
---ffmpeg -framerate 10 -i frame_%04d.png output.gif
---ExifTool — Metadata
ExifTool — 元数据处理
Read metadata
读取元数据
bash
exiftool input.jpg
exiftool -s input.jpg # short tag names
exiftool -ImageSize -DateTimeOriginal input.jpg # specific fieldsbash
exiftool input.jpg
exiftool -s input.jpg # 短标签名称
exiftool -ImageSize -DateTimeOriginal input.jpg # 指定字段Strip all metadata (privacy / pre-publish)
清除所有元数据(隐私保护 / 发布前处理)
bash
exiftool -all= input.jpg # strips in place (saves backup)
exiftool -all= -overwrite_original input.jpg # no backup
exiftool -all= -overwrite_original /folder/*.jpg # batch stripbash
exiftool -all= input.jpg # 原地清除(保存备份)
exiftool -all= -overwrite_original input.jpg # 不保存备份
exiftool -all= -overwrite_original /folder/*.jpg # 批量清除Copy EXIF from one file to another
复制元数据到另一个文件
bash
exiftool -TagsFromFile source.jpg target.jpgbash
exiftool -TagsFromFile source.jpg target.jpgWrite metadata
写入元数据
bash
exiftool -Artist="Ramon" -Copyright="© 2026 ReshareAI" input.jpg
exiftool -all= -overwrite_original -Artist="Ramon" /folder/*.jpgbash
exiftool -Artist="Ramon" -Copyright="© 2026 ReshareAI" input.jpg
exiftool -all= -overwrite_original -Artist="Ramon" /folder/*.jpgOptiPNG — Lossless PNG Compression
OptiPNG — 无损PNG压缩
bash
undefinedbash
undefinedOptimize (overwrites in place, creates backup .bak)
优化(原地覆盖,创建.bak备份)
optipng input.png
optipng input.png
No backup
不创建备份
optipng -o 7 input.png # -o 7 is max compression (slower)
optipng -o 7 input.png # -o 7为最高压缩比(速度较慢)
Output to new file
输出到新文件
optipng -out output.png input.png
optipng -out output.png input.png
Batch
批量处理
optipng /path/to/folder/*.png
optipng /path/to/folder/*.png
Check savings without writing
模拟压缩查看节省空间情况,不实际写入
optipng -simulate input.png
Typical savings: 20–50% file size reduction with zero quality loss.
---optipng -simulate input.png
通常可节省20–50%的文件大小,且画质无损失。
---jpegoptim — Lossless JPEG Compression
jpegoptim — 无损JPEG压缩
bash
undefinedbash
undefinedLossless optimization (in place)
无损优化(原地处理)
jpegoptim input.jpg
jpegoptim input.jpg
With target file size
指定目标文件大小
jpegoptim --size=200k input.jpg
jpegoptim --size=200k input.jpg
Strip all metadata + optimize
清除所有元数据并优化
jpegoptim --strip-all input.jpg
jpegoptim --strip-all input.jpg
Batch (folder)
批量处理文件夹
jpegoptim /path/to/folder/*.jpg
jpegoptim /path/to/folder/*.jpg
Batch with max quality floor
批量处理并设置最低画质
jpegoptim --max=90 /path/to/folder/*.jpg
---jpegoptim --max=90 /path/to/folder/*.jpg
---Poppler — PDF → Image
Poppler — PDF → 图像
bash
undefinedbash
undefinedAll pages → PNG at 150 DPI (output: file-000001.png, file-000002.png ...)
所有页面转换为150 DPI的PNG(输出:file-000001.png, file-000002.png ...)
pdftoppm -r 150 -png input.pdf /output/page
pdftoppm -r 150 -png input.pdf /output/page
All pages → JPEG
所有页面转换为JPEG
pdftoppm -r 150 -jpeg input.pdf /output/page
pdftoppm -r 150 -jpeg input.pdf /output/page
Single page (page 1 only)
单页转换(仅第1页)
pdftoppm -r 300 -png -f 1 -l 1 input.pdf /output/page
pdftoppm -r 300 -png -f 1 -l 1 input.pdf /output/page
High DPI for print-quality extraction
高DPI提取(印刷级画质)
pdftoppm -r 300 -png input.pdf /output/page
---pdftoppm -r 300 -png input.pdf /output/page
---Inkscape — CLI Reference
Inkscape — CLI 参考
SVG → PNG export (exact dimensions)
SVG → PNG导出(精确尺寸)
bash
inkscape input.svg \
--export-type=png \
--export-filename=output.png \
--export-width=1200 \
--export-height=630bash
inkscape input.svg \
--export-type=png \
--export-filename=output.png \
--export-width=1200 \
--export-height=630Export specific layer
导出指定图层
bash
inkscape input.svg \
--export-type=png \
--export-filename=output.png \
--export-id=layer1 \
--export-id-onlybash
inkscape input.svg \
--export-type=png \
--export-filename=output.png \
--export-id=layer1 \
--export-id-onlySVG → PDF
SVG → PDF
bash
inkscape input.svg --export-type=pdf --export-filename=output.pdfbash
inkscape input.svg --export-type=pdf --export-filename=output.pdfCreate SVG from scratch (write file, then export)
从头创建SVG(先写入文件,再导出)
Write a file using the Write tool, then export with Inkscape. SVG template:
.svgxml
<?xml version="1.0" encoding="UTF-8"?>
<svg width="1200" height="630" viewBox="0 0 1200 630"
xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#4C1D95"/>
<stop offset="100%" style="stop-color:#1E1B4B"/>
</linearGradient>
</defs>
<rect width="1200" height="630" fill="url(#bg)"/>
<!-- Text renders perfectly — no hallucination like GIMP/FLUX -->
<text x="100" y="280"
font-family="Inter, Arial, sans-serif"
font-size="96" font-weight="700"
fill="white">BrandName</text>
<text x="100" y="360"
font-family="Inter, Arial, sans-serif"
font-size="32" fill="rgba(255,255,255,0.7)">Tagline goes here</text>
</svg>使用写入工具创建文件,然后用Inkscape导出。SVG模板:
.svgxml
<?xml version="1.0" encoding="UTF-8"?>
<svg width="1200" height="630" viewBox="0 0 1200 630"
xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#4C1D95"/>
<stop offset="100%" style="stop-color:#1E1B4B"/>
</linearGradient>
</defs>
<rect width="1200" height="630" fill="url(#bg)"/>
<!-- 文本渲染完美 — 不会像GIMP/FLUX那样出现错误 -->
<text x="100" y="280"
font-family="Inter, Arial, sans-serif"
font-size="96" font-weight="700"
fill="white">BrandName</text>
<text x="100" y="360"
font-family="Inter, Arial, sans-serif"
font-size="32" fill="rgba(255,255,255,0.7)">Tagline goes here</text>
</svg>GIMP — Script-Fu Batch Reference
GIMP — Script-Fu 批量处理参考
Use GIMP for: compositing, color correction, photo editing, alpha channel work. For simple tasks prefer ImageMagick.
GIMP适用于:图像合成、色彩校正、照片编辑、Alpha通道处理。简单任务优先选择ImageMagick。
Resize to exact dimensions
调整至精确尺寸
bash
gimp --no-interface --batch '(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE "/path/input.png" "input.png")))
(drawable (car (gimp-image-get-active-drawable image))))
(gimp-image-scale-full image 1200 630 INTERPOLATION-LINEAR)
(file-png-save RUN-NONINTERACTIVE image (car (gimp-image-get-active-drawable image))
"/path/output.png" "output.png" 0 9 1 1 1 1 1))
(gimp-quit 0)'bash
gimp --no-interface --batch '(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE "/path/input.png" "input.png")))
(drawable (car (gimp-image-get-active-drawable image))))
(gimp-image-scale-full image 1200 630 INTERPOLATION-LINEAR)
(file-png-save RUN-NONINTERACTIVE image (car (gimp-image-get-active-drawable image))
"/path/output.png" "output.png" 0 9 1 1 1 1 1))
(gimp-quit 0)'Scale then crop (fill mode — covers full canvas)
缩放后裁剪(填充模式 — 覆盖整个画布)
bash
gimp --no-interface --batch '(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE "/path/input.jpg" "input.jpg")))
(w (car (gimp-image-width image)))
(h (car (gimp-image-height image)))
(target-w 1200) (target-h 630)
(scale (max (/ target-w w) (/ target-h h)))
(new-w (inexact->exact (round (* w scale))))
(new-h (inexact->exact (round (* h scale)))))
(gimp-image-scale-full image new-w new-h INTERPOLATION-LINEAR)
(gimp-image-crop image target-w target-h
(/ (- new-w target-w) 2) (/ (- new-h target-h) 2))
(file-png-save RUN-NONINTERACTIVE image (car (gimp-image-get-active-drawable image))
"/path/output.png" "output.png" 0 9 1 1 1 1 1))
(gimp-quit 0)'bash
gimp --no-interface --batch '(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE "/path/input.jpg" "input.jpg")))
(w (car (gimp-image-width image)))
(h (car (gimp-image-height image)))
(target-w 1200) (target-h 630)
(scale (max (/ target-w w) (/ target-h h)))
(new-w (inexact->exact (round (* w scale))))
(new-h (inexact->exact (round (* h scale)))))
(gimp-image-scale-full image new-w new-h INTERPOLATION-LINEAR)
(gimp-image-crop image target-w target-h
(/ (- new-w target-w) 2) (/ (- new-h target-h) 2))
(file-png-save RUN-NONINTERACTIVE image (car (gimp-image-get-active-drawable image))
"/path/output.png" "output.png" 0 9 1 1 1 1 1))
(gimp-quit 0)'Add semi-transparent colour overlay
添加半透明颜色叠加层
bash
gimp --no-interface --batch '(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE "/path/input.png" "input.png")))
(overlay (car (gimp-layer-new image
(car (gimp-image-width image))
(car (gimp-image-height image))
RGBA-IMAGE "overlay" 60 LAYER-MODE-NORMAL))))
(gimp-image-insert-layer image overlay 0 -1)
(gimp-context-set-foreground (list 0 0 0))
(gimp-edit-fill overlay FILL-FOREGROUND)
(file-png-save RUN-NONINTERACTIVE image (car (gimp-image-flatten image))
"/path/output.png" "output.png" 0 9 1 1 1 1 1))
(gimp-quit 0)'bash
gimp --no-interface --batch '(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE "/path/input.png" "input.png")))
(overlay (car (gimp-layer-new image
(car (gimp-image-width image))
(car (gimp-image-height image))
RGBA-IMAGE "overlay" 60 LAYER-MODE-NORMAL))))
(gimp-image-insert-layer image overlay 0 -1)
(gimp-context-set-foreground (list 0 0 0))
(gimp-edit-fill overlay FILL-FOREGROUND)
(file-png-save RUN-NONINTERACTIVE image (car (gimp-image-flatten image))
"/path/output.png" "output.png" 0 9 1 1 1 1 1))
(gimp-quit 0)'Composite: place image B on top of image A
图像合成:将图像B叠加在图像A上方
bash
gimp --no-interface --batch '(let* (
(base (car (gimp-file-load RUN-NONINTERACTIVE "/path/base.png" "base.png")))
(overlay-img (car (gimp-file-load RUN-NONINTERACTIVE "/path/overlay.png" "overlay.png")))
(overlay-layer (car (gimp-layer-new-from-drawable
(car (gimp-image-get-active-drawable overlay-img)) base))))
(gimp-image-insert-layer base overlay-layer 0 -1)
(gimp-layer-set-offsets overlay-layer 50 50)
(file-png-save RUN-NONINTERACTIVE base (car (gimp-image-flatten base))
"/path/output.png" "output.png" 0 9 1 1 1 1 1))
(gimp-quit 0)'bash
gimp --no-interface --batch '(let* (
(base (car (gimp-file-load RUN-NONINTERACTIVE "/path/base.png" "base.png")))
(overlay-img (car (gimp-file-load RUN-NONINTERACTIVE "/path/overlay.png" "overlay.png")))
(overlay-layer (car (gimp-layer-new-from-drawable
(car (gimp-image-get-active-drawable overlay-img)) base))))
(gimp-image-insert-layer base overlay-layer 0 -1)
(gimp-layer-set-offsets overlay-layer 50 50)
(file-png-save RUN-NONINTERACTIVE base (car (gimp-image-flatten base))
"/path/output.png" "output.png" 0 9 1 1 1 1 1))
(gimp-quit 0)'Brightness / contrast / saturation
亮度 / 对比度 / 饱和度调整
bash
gimp --no-interface --batch '(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE "/path/input.jpg" "input.jpg")))
(drawable (car (gimp-image-get-active-drawable image))))
(gimp-brightness-contrast drawable 20 30)
(gimp-drawable-hue-saturation drawable HUE-RANGE-ALL 0 0 25 0)
(file-jpeg-save RUN-NONINTERACTIVE image drawable
"/path/output.jpg" "output.jpg" 0.92 0 0 0 "" 0 1 0 2 0))
(gimp-quit 0)'bash
gimp --no-interface --batch '(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE "/path/input.jpg" "input.jpg")))
(drawable (car (gimp-image-get-active-drawable image))))
(gimp-brightness-contrast drawable 20 30)
(gimp-drawable-hue-saturation drawable HUE-RANGE-ALL 0 0 25 0)
(file-jpeg-save RUN-NONINTERACTIVE image drawable
"/path/output.jpg" "output.jpg" 0.92 0 0 0 "" 0 1 0 2 0))
(gimp-quit 0)'Recommended Workflow: OG Image / Social Banner
推荐工作流:OG图像 / 社交横幅制作
- Write an SVG file (exact layout, text, colors) using the Write tool
- Export with Inkscape at target dimensions — text is pixel-perfect
- Optimize with OptiPNG before publishing
bash
undefined- 编写SVG文件(精确布局、文本、颜色),使用写入工具完成
- 导出用Inkscape导出至目标尺寸 — 文本像素级精准
- 优化发布前用OptiPNG优化
bash
undefinedStep 1: write /tmp/card.svg
步骤1:写入/tmp/card.svg
Step 2: export
步骤2:导出
inkscape /tmp/card.svg
--export-type=png
--export-filename=/output/og.png
--export-width=1200
--export-height=630
--export-type=png
--export-filename=/output/og.png
--export-width=1200
--export-height=630
inkscape /tmp/card.svg
--export-type=png
--export-filename=/output/og.png
--export-width=1200
--export-height=630
--export-type=png
--export-filename=/output/og.png
--export-width=1200
--export-height=630
Step 3: optimize
步骤3:优化
optipng -o 5 /output/og.png
---optipng -o 5 /output/og.png
---Tips
小贴士
- Text accuracy: Inkscape SVG > ImageMagick > GIMP Script-Fu (avoid for text)
-annotate - Speed hierarchy: ImageMagick > GIMP for simple ops; GIMP wins for complex compositing
- GIMP — always end scripts with
--no-interface(gimp-quit 0) - Script-Fu paths must be absolute — no shortcuts
~/ - GIMP opacity is 0–100 (integer), not 0.0–1.0
- Inkscape 1.1 uses +
--export-type(older versions used--export-filename)--export-png - ImageMagick suffix on geometry forces exact dimensions ignoring aspect ratio (
!)1200x630!
- 文本准确性:Inkscape SVG > ImageMagick > GIMP Script-Fu(避免用GIMP处理文本)
-annotate - 速度优先级:简单操作ImageMagick比GIMP快;复杂合成GIMP更胜一筹
- GIMP — 脚本末尾必须添加
--no-interface(gimp-quit 0) - Script-Fu路径必须是绝对路径 — 不支持快捷方式
~/ - GIMP透明度范围是0–100(整数),而非0.0–1.0
- Inkscape 1.1使用+
--export-type(旧版本使用--export-filename)--export-png - ImageMagick尺寸参数后的后缀强制使用精确尺寸,忽略宽高比(如
!)1200x630!