I'm attempting to open two images and paste one on top of the other as it's own layer using a script-fu. I need to then call this script from the command line (windows) passing in two file names.
Here's my .scm code:
(define (open-as-layer file1 file2)
(let* (
; first main image
(image (car (gimp-file-load RUN-NONINTERACTIVE file1 file1)))
; them layer
(draw1 (car (gimp-image-get-active-drawable image)))
; open image as layer
(draw2 (car (gimp-file-load-layer RUN-NONINTERACTIVE image file2)))
)
; add layer to image
(gimp-image-insert-layer image draw2 0 0)
)
)
When I used this command:
gimp-2.10 -d -b '(open-as-layer "C:\Users\me\Desktop\testoriginal.pgm" "C:\Users\me\Desktop\testfinished.pgm")'
Gimp opens and loads the first image fine, but produces this error on loading the second:
Opening 'C:\Users\me\Desktop\testfinished.pgm)'' failed: Error opening file C:\Users\me\Desktop\testfinished.pgm)': No such file or directory
The error shows that it thinks the file name is C:\Users\me\Desktop\testfinished.pgm)'
, notice the )'
is included. So I tried adding a space after the full file name in the command:
gimp-2.10 -d -b '(open-as-layer "C:\Users\me\Desktop\testoriginal.pgm" "C:\Users\me\Desktop\testfinished.pgm" )'
And gimp now loads both images in separate tabs, but tries to load a third image and fails with this error:
Opening 'C:\Program Files\GIMP 2\bin\)'' failed: Error opening file C:\Program Files\GIMP 2\bin\)': No such file or directory
Again, it tried to load an image (an empty string?) but included the )'
All I need is to get it to recognize just the string within the double quotes.