Сохранить как в нескольких файлах одновременно (GIMP)
Вопрос
У меня есть серия .xcf изображения, которые я хочу сохранить как .png.Я могу открыть каждый файл и сохранить как .png но поскольку изображений много, это заняло бы изрядное количество времени.
Есть ли способ преобразовать все изображения сразу, или другой способ, которым я должен тратить меньше времени на эту работу?
Заранее спасибо.
Нет правильного решения
Другие советы
Я бы использовал консоль Python внутри GIMP для этого - если вы должны быть в Windows, посмотрите, как установить расширение Python для GIMP 2.6 (на Linux его либо поставляется, либо имеет значение для установкиGIMP-Python Package, наверное, одинаково на Mac OS)
из консоли Python Gimp Python у вас есть доступ к огромной API GIMP, вы можете проверить, посмотрев на диалоговое окно браузера спрашиваемой справки -> процедуру - помимо того, что имеющие все другие функции 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-адресом каталога, используемый по умолчанию - объединяет Desredied Directory для FilePaths для работы на других режимах).
Если вам нужно, чтобы это не раз, посмотрите на примерные плагины, которые поставляются с GIMP-Python, и вставьте код выше в виде сервера Phyton для GIMP для вашего собственного использования.
Хорошо, если у вас установлен imagemagick
, вы можете сделать это как:
mogrify -format png *.xcf
.
Это автоматически преобразует их в одном каталоге.Также прочитайте man mogrify
или это для других вариантов.
Вы можете быстро создать плагин, называемый Saveall.Сохраните этот код к некоторому файлу с расширением .scm (e.g. 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).
Тогда вам даже не нужно перезапустить приложение.<Сильные> Фильтры Меню -> <Сильные> скрипт-фу -> Обновление скриптов .У вас будет
Этот скрипт поступает из здесь .
Есть также Другой скрипт , но я сам не проверил. .
{
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 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.
УЧЛИН УИЛКИНСОН СОХРАНИТ ВСЕ ОТКРЫТЫЕ ИЗОБРАЖЕНИЯ ИЗ GIMP.
Удобно, если вы сканируете много изображений и хотите просто экспортировать их все за один раз.Он основан на скрипте Сола Гуда, расширенном для запроса базового имени изображения, каталога и т.д.
Сохраните его как 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)
)