Pregunta

Tengo una serie de imágenes .xcf que quiero guardar como .png .Puedo abrir cada archivo y guardar como .png Pero ya que hay muchas imágenes, tomaría una buena cantidad de tiempo.

¿Hay alguna manera de convertir todas las imágenes a la vez, o de otra manera que tenga que pasar menos tiempo en este trabajo?

Gracias de antemano.

No hay solución correcta

Otros consejos

Utilizaría la consola de Python dentro de GIMP para eso: si está en Windows, eche un vistazo a cómo instalar la extensión Python para GIMP 2.6 (en Linux, se encuentra, no se encuentra, es una cuestión de instalar elPaquete de Gimp-Python, probablemente lo mismo en Mac OS)

Desde dentro de la consola de Python de GIMP, tiene acceso a una enorme API de GIMP, puede consultar al ver el cuadro de diálogo Ayuda-> Procedimiento del navegador, además de tener todas las demás características de Python, incluida la manipulación de archivos y estruendo.

uno que eres= en la consola de Python-Fu, es una cuestión de hacer algo como esto:

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)

(Esto funcionará en el directorio GIMP utiliza como predeterminado: concatenar el directorio deseado a los filepaths para trabajar en otros dirs).

Si lo necesita más de una vez, eche un vistazo a los complementos de ejemplo que vienen con GIMP-PYTHON, y pegue el código anterior como el núcleo para un complemento de Python para GIMP para su propio uso.

Bueno, si tiene instalado imagemagick, puede hacerlo como:

mogrify -format png *.xcf

Esto los convierte automáticamente en el mismo directorio.También lee man mogrify o este para otras opciones.

Puede crear rápidamente un complemento llamado SaveAll.Guarde este código en algún archivo con la extensión .scm (por ejemplo, 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" 
 "" 
 ) 

Ponga el archivo en la carpeta de plugins con la misma extensión (En Windows es C: \ Archivos de programa \ GIMP 2 \ Share \ GIMP \ 2.0 \ Scripts).

Entonces, ni siquiera tienes que reiniciar la aplicación. filtros Menú -> script-fu -> Actualizar scripts .Tendrás Guardar todo elemento en el menú Archivo (en la parte inferior).Funciona rápido para mí.

Este script proviene de aquí .

También hay otro script , pero no lo he probado yo mismo.

{
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 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)
 )

}

Este script funciona perfectamente en gimp 2.8 Windows 7.

Uchlin Wilkinson Guardar todas las imágenes abiertas de GIMP.

Handy Si está escaneando en muchas imágenes y simplemente desea exportarlas todas de una sola vez.Se basa en un script por Saul Goode, extendido para solicitar el nombre de la base de imágenes, el directorio, etc.

Guardarlo como SaveAll.scm en su directorio de scripts de GIMP.P.ej.~ / .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)
 )

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top