题
我有一系列 .xcf 我想另存为的图像 .png. 。我可以打开每个文件并另存为 .png 但由于图像较多,因此需要相当长的时间。
有没有一种方法可以一次转换所有图像,或者有另一种方法可以减少我在这项工作上花费的时间?
先感谢您。
没有正确的解决方案
其他提示
我将使用gimp内的python控制台为此 - 如果您碰巧在Windows中,请查看如何安装GIMP 2.6的Python扩展名(在Linux上,它无论是缺乏还是安装gimp-python包,Mac OS上可能相同)
从GIMP的Python控制台内,您可以访问一个巨大的GIMP API,您可以通过查看帮助 - >程序浏览器对话框来检查 - 除了具有Python的所有其他功能,包括文件和争取操作。
一个你是=在python-fu控制台中,事情做出了这样的事情:
import glob
for fname in glob.glob("*.xcf"):
img = pdb.gimp_file_load(fname, fname)
img.flatten()
new_name = fname[:-4] + ".png"
pdb.gimp_file_save(img, img.layers[0], new_name, new_name)
.
(这将在目录gimp上使用默认使用 - 将desried目录连接到Filepaths以在其他目录上工作)。
如果您需要多次,请查看带有gimp-python的示例插件,并将上面的代码粘贴为mimp的核心为您自己使用。
好吧,如果你有 imagemagick
安装后,你可以这样做:
mogrify -format png *.xcf
这会在同一目录中自动转换它们。另请阅读 man mogrify
或这个 对于其他选项。
您可以快速创建名为SaveAll的插件。将此代码保存到具有.scm扩展(例如saveall.scm)的某个文件:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
(define (script-fu-save-all-images)
(let* ((i (car (gimp-image-list)))
(image))
(while (> i 0)
(set! image (vector-ref (cadr (gimp-image-list)) (- i 1)))
(gimp-file-save RUN-NONINTERACTIVE
image
(car (gimp-image-get-active-layer image))
(car (gimp-image-get-filename image))
(car (gimp-image-get-filename image)))
(gimp-image-clean-all image)
(set! i (- i 1)))))
(script-fu-register "script-fu-save-all-images"
"<Image>/File/Save ALL"
"Save all opened images"
"Saul Goode"
"Saul Goode"
"11/21/2006"
""
)
.
将文件放入具有相同扩展名的插件文件夹中 (在Windows上是C:\ Program Files \ Gimp 2 \ Share \ Gimp \ 2.0 \脚本)。
然后您甚至不必重新启动应用程序。过滤器菜单 - > script-fu - > 更新脚本。您将在文件菜单(在非常底部)中保存所有项目。它适合我很容易。
这个脚本来自这里。
还有另一个脚本,但我还没有自己测试它。
{
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This program is free software; you
; can redistribute it and/or modify
; it under the terms of the GNU
; General Public License as published
; by the Free Software Foundation;
; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the
; hope that it will be useful,
; but WITHOUT ANY WARRANTY;
; without even the implied warranty of
; MERCHANTABILITY or FITNESS
; FOR A PARTICULAR PURPOSE.
; See the GNU General Public License
; for more details.
(define (script-fu-save-all-images inDir inSaveType
inFileName inFileNumber)
(let* (
(i (car (gimp-image-list)))
(ii (car (gimp-image-list)))
(image)
(newFileName "")
(saveString "")
(pathchar (if (equal?
(substring gimp-dir 0 1) "/") "/" "\\"))
)
(set! saveString
(cond
(( equal? inSaveType 0 ) ".jpg" )
(( equal? inSaveType 1 ) ".bmp" )
(( equal? inSaveType 2 ) ".png" )
(( equal? inSaveType 3 ) ".tif" )
)
)
(while (> i 0)
(set! image (vector-ref (cadr (gimp-image-list)) (- i 1)))
(set! newFileName (string-append inDir
pathchar inFileName
(substring "00000" (string-length
(number->string (+ inFileNumber i))))
(number->string (+ inFileNumber i)) saveString))
(gimp-file-save RUN-NONINTERACTIVE
image
(car (gimp-image-get-active-layer image))
newFileName
newFileName
)
(gimp-image-clean-all image)
(set! i (- i 1))
)
)
)
(script-fu-register "script-fu-save-all-images"
"<Image>/File/Save ALL As"
"Save all opened images as ..."
"Lauchlin Wilkinson (& Saul Goode)"
"Lauchlin Wilkinson (& Saul Goode)"
"2014/04/21"
""
SF-DIRNAME "Save Directory" ""
SF-OPTION "Save File Type" (list "jpg" "bmp" "png" "tif")
SF-STRING "Save File Base Name" "IMAGE"
SF-ADJUSTMENT "Save File Start Number"
(list 0 0 9000 1 100 0 SF-SPINNER)
)
}
. 此脚本在gimp 2.8
Windows 7中完美工作。
uchlin wilkinson从gimp保存所有打开的图像。
Handy如果您正在扫描在很多图像中,并且只想一次性导出它们。它基于Saul Goode的脚本,扩展到提示图片基本名称,目录等。
将其保存为gimp脚本目录中的saveall.scm。例如。〜/ .gimp-2.8 / scripts /
.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This program is free software; you ; can redistribute it and/or modify ; it under the terms of the GNU ; General Public License as published ; by the Free Software Foundation; ; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the ; hope that it will be useful, ; but WITHOUT ANY WARRANTY; ; without even the implied warranty of ; MERCHANTABILITY or FITNESS ; FOR A PARTICULAR PURPOSE. ; See the GNU General Public License ; for more details. (define (script-fu-save-all-images inDir inSaveType inFileName inFileNumber) (let* ( (i (car (gimp-image-list))) (ii (car (gimp-image-list))) (image) (newFileName "") (saveString "") (pathchar (if (equal? (substring gimp-dir 0 1) "/") "/" "\\")) ) (set! saveString (cond (( equal? inSaveType 0 ) ".jpg" ) (( equal? inSaveType 1 ) ".bmp" ) (( equal? inSaveType 2 ) ".png" ) (( equal? inSaveType 3 ) ".tif" ) ) ) (while (> i 0) (set! image (vector-ref (cadr (gimp-image-list)) (- i 1))) (set! newFileName (string-append inDir pathchar inFileName (substring "00000" (string-length (number->string (+ inFileNumber i)))) (number->string (+ inFileNumber i)) saveString)) (gimp-file-save RUN-NONINTERACTIVE image (car (gimp-image-get-active-layer image)) newFileName newFileName ) (gimp-image-clean-all image) (set! i (- i 1)) ) ) ) (script-fu-register "script-fu-save-all-images" "<Image>/File/Save ALL As" "Save all opened images as ..." "Lauchlin Wilkinson (& Saul Goode)" "Lauchlin Wilkinson (& Saul Goode)" "2014/04/21" "" SF-DIRNAME "Save Directory" "" SF-OPTION "Save File Type" (list "jpg" "bmp" "png" "tif") SF-STRING "Save File Base Name" "IMAGE" SF-ADJUSTMENT "Save File Start Number" (list 0 0 9000 1 100 0 SF-SPINNER) )