在 GIMP 里批量处理图片有几种常见方式,适合不同需求。下面按从易到简单 → 进阶给你讲清楚。
GIMP 本身没有内置批量处理,但可以用插件 BIMP(Batch Image Manipulation Plugin)。
✅ 适合:
GIMP 支持 Script-Fu(Scheme) 或 Python-Fu。
for file in files:
image = pdb.gimp_file_load(file, file)
layer = image.layers[0]
new_file = file.replace(".png", ".jpg")
pdb.file_jpeg_save(image, layer, new_file, new_file, 0.9, 0, 0, 0, "", 0, 1, 0, 0)
⚠️ 缺点:
如果你只是批量改尺寸 / 格式 / 压缩,ImageMagick 更快。
# 批量转 JPG
mogrify -format jpg *.png
# 批量改尺寸
mogrify -resize 800x800 *.jpg
✅ 优点:
✅ 适合:
❌ 不适合:
你可以告诉我:
我可以给你最合适的方案 + 一步步操作截图说明。