CentOS 下使用 GIMP 进行文件格式转换
一 安装与准备
二 图形界面快速转换
三 命令行与批处理
gimp -i -b '(let* ((image (car (file-jpeg-load RUN-NONINTERACTIVE "input.jpg" "input.jpg")))
(drawable (car (gimp-image-get-active-layer image))))
(gimp-file-save RUN-NONINTERACTIVE image drawable "output.png" "output.png")
(gimp-quit 0))' -b '(gimp-quit 0)'
#!/usr/bin/env bash
for f in *.jpg; do
[ -e "$f" ] || continue
out="${f%.jpg}.png"
gimp -i -b "(let* ((image (car (file-jpeg-load RUN-NONINTERACTIVE \"$f\" \"$f\")))
(drawable (car (gimp-image-get-active-layer image))))
(gimp-file-save RUN-NONINTERACTIVE image drawable \"$out\" \"$out\")
(gimp-quit 0))" -b '(gimp-quit 0)'
done
四 进阶与常见问题