在Debian上使用GIMP批处理功能,主要有以下两种方法:
(define (batch-resize pattern size) (let* ((filelist (cadr (file-glob pattern 1)))) (while (not (null? filelist)) (let* ((filename (car filelist)) (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (drawable (car (gimp-image-get-active-layer image)))) (gimp-image-scale image size size) (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename) (gimp-image-delete image)) (set! filelist (cdr filelist))))(batch-resize "*.jpg" 1000)。保存脚本后,在终端中运行gimp -b -i input.jpg -o output.jpg -s script_name.scm来执行批处理。batch_resize.sh的脚本文件,内容为#!/bin/bash,然后添加代码,如检查参数、遍历输入目录图片、使用GIMP调整尺寸等,最后保存并赋予执行权限chmod +x batch_resize.sh,运行脚本即可。