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

Camille Desmots

<<attachment: camille_desmots-ext.vcf>>

gimp-docs-list mailing list

Reply via email to