我有一系列.xcf我要保存为png格式图像。我可以打开每个文件并保存为.png但由于有很多图像需要相当长的时间。保存在多个文件上一次(GIMP)
有没有办法一次转换所有图像,或者我不得不在这项工作上花费更少时间?
预先感谢您。
我有一系列.xcf我要保存为png格式图像。我可以打开每个文件并保存为.png但由于有很多图像需要相当长的时间。保存在多个文件上一次(GIMP)
有没有办法一次转换所有图像,或者我不得不在这项工作上花费更少时间?
预先感谢您。
那么,如果你已经安装了imagemagick
,你可以不喜欢它:
mogrify -format png *.xcf
这在同一个目录下自动将它们转换。对于其他选项,还请阅读man mogrify
or this。
我想在GIMP中使用Python控制台 - 如果你碰巧在Windows中,请看看如何安装GIMP 2.6的Python扩展(在Linux上,它可能是安装或安装的问题gimp-python软件包,可能与Mac OS相同)
在GIMP的Python控制台中,您可以访问巨大的GIMP API,您可以通过查看帮助 - >程序浏览器对话框 - 除了具有所有其他功能的Python,包括文件和严格的操作。
一,你是在Python福控制台=,它是做这样的事情:
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目录的文件路径在其他dirs上工作)。
如果您不止一次需要,请查看gimp-Python附带的示例插件,并粘贴上面的代码作为GIMP的python插件的核心,供您自己使用。
您可以快速创建名为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 \共享\瘸子\ 2.0 \脚本)。
然后你甚至不必重新启动应用程序。 Filters menu - >Script-Fu - >更新脚本。您将有保存全部项目在文件菜单(在最底部)。它对我来说很简单。
此脚本来自here。
还有another脚本,但我没有自己测试过。
这个脚本完全在gimp 2.8
Windows 7中
UCHLIN WILKINSON保存所有打开的图像从GIMP。
如果您正在扫描大量图像并且您只是想一次输出所有图像,那么方便。它基于Saul Goode的脚本,扩展为提示图像库名称,目录等。
将它作为saveall.scm保存在Gimp脚本目录中。例如。 〜/ .gimp-2.8 /脚本/
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 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)
)
{
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 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)
)
}
噢,这是太难过了,你开始回答“我想用户的Python” ......一定是出在这样的工具盒。感谢您的解决方法 – ruX 2015-03-24 16:49:21
嘿,@ruX,毕竟这是在stackoverflow问,而不是在graphicdesign。你会期待什么? ;-) – hypers 2016-10-24 16:02:01
作为批量转换工具不是GIMP的核心目标。不过,这可以通过第三方脚本来完成,而且,对脚本生态系统缺乏更好的支持。 – jsbueno 2016-10-25 12:40:50