<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi, <br>
<br>
I have done a batch job for converting PDF to PNG in batch mode.<br>
<h5>The source of the file "batch-pdf-to-png.scm"</h5>
<pre><font size="-1">; 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</font></pre>
Example of command line on Windows (in the same directory as the
script):<br>
<pre><font size="-1">"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)";</font></pre>
<div class="moz-signature">-- <br>
<div class="signature1">
Cordialement.<br>
Camille Desmots<br>
</div>
<style>
body {
color:black;
background-color:#CCCCCC;
counter-reset: h1_counter}
p {background-color:#CCCCCC;}
pre {background-color:DarkGrey;}
h1 {size:6;
margin-top: 20 px;
margin-bottom: 10px;
border-bottom: 6px solid black;
counter-reset: h2_counter}
h1:before {
counter-increment: h1_counter;
content: counter(h1_counter) " - "}
h2:before {
counter-increment: h2_counter;
content: counter(h1_counter) "." counter(h2_counter) " - ";}
h3:before,
h4:before,
h5:before,
h6:before {content:"- ";}
h2 {size:5;
margin-top: 20 px;
margin-bottom: 10px;
border-bottom: 5px solid black;}
h3 {size:4;
margin-top: 20 px;
margin-bottom: 10px;
border-bottom: 4px solid black;}
h4 {size:3;
margin-top: 20 px;
margin-bottom: 10px;
border-bottom: 3px solid black;}
h5 {size:2;
margin-top: 20 px;
margin-bottom: 10px;
border-bottom: 2px solid black;}
h6 {size:1;
margin-top: 20 px;
margin-bottom: 10px;
border-bottom: 1px solid black;}
@keyframes animation1 {
from {background-color: #ccffcc;}
to {background-color: #ffdb99;}}
.signature1 {
size:1;
width: 210px;
height: 155px;
animation-name: animation1;
animation-duration: 4s;}
</style></div>
</body>
</html>