xcf2png -- 不支持 XCF 版本 12

Ste*_*ton 4 gimp png

  • GIMP 2.10.8
  • 乌班图19.10
  • xcftools_1.0.7-6_amd64

我想使用命令行将 Gimp xcf 文件转换为 png。输出文件rose.png失败。

xcf2png rose.xcf -o rose.png 
Warning: XCF version 12 not supported (trying anyway...)
Run Code Online (Sandbox Code Playgroud)

Gry*_*ryu 6

xcf2png太老了,不支持XCF 11、12版本。但如果您想使用终端转换 xcf 文件,请在包含 .xcf 文件的文件夹中运行下一个脚本命令:

gimp -n -i -b - <<EOF
(let* ( (file's (cadr (file-glob "*.xcf" 1))) (filename "") (image 0) (layer 0) )
  (while (pair? file's) 
    (set! image (car (gimp-file-load RUN-NONINTERACTIVE (car file's) (car file's))))
    (set! layer (car (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)))
    (set! filename (string-append (substring (car file's) 0 (- (string-length (car file's)) 4)) ".png"))
    (gimp-file-save RUN-NONINTERACTIVE image layer filename filename)
    (gimp-image-delete image)
    (set! file's (cdr file's))
    )
  (gimp-quit 0)
  )
EOF
Run Code Online (Sandbox Code Playgroud)

结果,png 文件显示正确的图像:

$ ls
red_rectangle.png  red_rectangle.xcf
Run Code Online (Sandbox Code Playgroud)

参考