質問
私は .png として保存したい一連の .xcf 画像を持っています。私は各ファイルを開いて .png として保存することができますが、たくさんの画像があるため、かなりの時間がかかります。
すべての画像を一度に変換する方法、あるいはこの仕事に時間がかかる時間を費やす必要がある方法はありますか?
事前にありがとうございました。
正しい解決策はありません
他のヒント
GIMP内のPythonコンソールを使用します.Windowsに入っている場合は、GIMP 2.6のPython拡張子のインストール方法を調べてください(Linux上ではisNtalledが入っているか、インストールすることの問題です。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)
.
(これはDirectory Gimpではデフォルトとして機能します。デスクディレクトリをファイルパス内に連結して、他のDIRSに連結されます)。
それ以降の必要がある場合は、GIMP-Pythonで付属のプラグインを調べて、上記のコードを自分の使用のためのPythonプラグインのコアとして貼り付けます。
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¥scripts)。
その後、アプリを再起動する必要はありません。フィルタメニュー - > script-fu - > 更新スクリプト。 file メニュー(非常に下にある)にすべての項目を保存することができます。それは私にとって簡単なことが簡単です。
このスクリプトはこちら
{
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 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から開いている画像をすべて保存します。
便利な画像をたくさんスキャンしていて、あなたはただそれらを1つの時間にエクスポートしたいだけです。それはSaul Goodeによるスクリプトに基づいています。
GIMP SCRIPTSディレクトリにSAVeall.scmとして保存します。例えば。〜/ .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) )