about summary refs log tree commit diff
path: root/bin/xcf-to-pdf
blob: 34da9c8e6c36be9ce584301f2ae294f12690774e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
{
cat <<EOF
(define (convert-xcf-to-pdf filename outfile)
  (let* (
     (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
     (drawable (car (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)))
     )
    (file-pdf-save RUN-NONINTERACTIVE image drawable outfile outfile TRUE TRUE TRUE)
    (gimp-image-delete image) ; ... or the memory will explode
    )
)

(gimp-message-set-handler 1) ; Messages to standard output
EOF

for i in $*; do
  echo "(gimp-message \"$i\")"
  echo "(convert-xcf-to-pdf \"$i\" \"${i%%.xcf}.pdf\")"
done

echo "(gimp-quit 0)"
} | gimp -i -b -