在 Ubuntu 下用 GIMP 做批量修图,常见有几种方式,从简单到进阶给你讲清楚。
BIMP(Batch Image Manipulation Plugin) 是 GIMP 最常用的批量处理插件。
sudo apt update
sudo apt install gimp-plugin-registry
(部分版本已包含 BIMP)
或手动安装:
sudo apt install git build-essential libgimp2.0-dev
git clone https://github.com/alessandrofama/bimp
cd bimp
make
sudo make install
Filters → Batch Image Manipulation✅ 适合:批量改尺寸、格式、加水印
适合固定流程。
示例(批量缩放):
(define (batch-resize filename width height)
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(gimp-image-scale image width height)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)))
运行:
gimp -i -b '(batch-resize "1.jpg" 800 600)' -b '(gimp-quit 0)'
Ubuntu 默认可能没装 Python 支持:
sudo apt install gimp-python
示例思路:
适合程序员。
如果你只是批量处理,Ubuntu 下这些比 GIMP 更高效:
sudo apt install imagemagick
批量改尺寸:
mogrify -resize 800x600 *.jpg
批量加水印:
convert input.jpg -annotate +10+10 "Copyright" output.jpg
✅ 速度极快,适合服务器 / 脚本
sudo apt install darktable
适合:
| 需求 | 推荐 |
|---|---|
| 简单批量改图 | BIMP |
| 固定流程 | Script-Fu / Python |
| 超大量图片 | ImageMagick |
| 摄影后期 | darktable |
如果你愿意,可以告诉我:
我可以直接给你可复制的命令或配置。