Example of script that convert in batch PDF to PNG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have done a batch job for converting PDF to PNG in batch mode.
The source of the file "batch-pdf-to-png.scm"
; BEGIN SCRIPT FU
(  
   define (batch-pdf-to-png pattern)(
      let* (
         (filelist (cadr (file-glob pattern 1)))
         (filename)
         (image)
         (drawable)
         (fileparts)      
         (pngfilename)
      )
      (gimp-message "Preparing to act on the following files")
      (gimp-message pattern)
      (while (not (null? filelist))
         (set! filename (car filelist)) 
         (gimp-message "The current file is: ") (gimp-message filename)
         (set! image (car (file-pdf-load RUN-NONINTERACTIVE filename filename)))
         (set! drawable (car (gimp-image-get-active-layer image)))
         (set! fileparts (strbreakup filename "."))
         (set! fileparts (butlast fileparts)) 
         (set! pngfilename (string-append (unbreakupstr fileparts ".") ".png")) 
         (gimp-message "The new filename will be: ") 
         (gimp-message pngfilename)
         (file-png-save-defaults RUN-NONINTERACTIVE image drawable pngfilename pngfilename)
         (gimp-image-delete image)
         (set! filelist (cdr filelist))
      )
   )
)
; END SCRIPT FU
Example of command line on Windows (in the same directory as the script):
"C:\Program Files\GIMP 2\bin\gimp-2.8.exe" -i -b "(batch-pdf-to-png \"C:\\My\ project\\My\ PDFs\\*.pdf\")" -b "(gimp-quit 0)";
--
Cordialement.
Camille Desmots
begin:vcard
fn:Camille Desmots
n:Desmots;Camille
org;quoted-printable;quoted-printable:Rectorat de l'acad=C3=A9mie de Rennes;SERIA - D=C3=A9partement des =C3=A9tudes nationales
adr;dom:;;18 rue Jean-Julien Lemordant;Rennes;;35000
email;internet:camille.desmots-ext@xxxxxxxxxxxx
title:Prestataire (Sodifrance)
tel;work:0223201758
x-mozilla-html:TRUE
version:2.1
end:vcard

_______________________________________________
gimp-docs-list mailing list
gimp-docs-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gimp-docs-list

[Index of Archives]     [Video For Linux]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [Scanners]     [GEGL]     [Gimp's Home]     [Gimp on Windows]     [Steve's Art]     [Webcams]

  Powered by Linux