GIMP Script-fu to print an image?
I'm not a Script-fu expert but I did manage to get a Script-fu script to at least not throw up any errors. However, it also doesn't work.
I've written a bash script to use gphoto2 and imagemagick to snap a picture, download, rotate and crop it ready for print. I'd like to automate the final step and have The GIMP or some other program print it. My script-fu script is: (define (printshot filename) (let* ((image (car(gimp-file-load RUN-NONINTERACTIVE filename filename))) (gimp-print-gtk RUN-NONINTERACTIVE image) (gimp-image-delete image))) ) and my bash script to call it is: gimp -i -b '(printshot $1)' -b '(gimp-quit)' I know it's executing the script-fu script because I have received error messages when I do something invalid in it. However, I don't get any output. I get the same thing when I run it from the Script-fu console. It seems to execute but doesn't print anything. What am I doing wrong? |
OK, I finally got it. My working script is:
(define (printshot filename) (let* ( (image (car(gimp-file-load RUN-INTERACTIVE filename filename))) ) (file-print-gtk RUN-INTERACTIVE image) (gimp-image-delete image) ) ) I don't think the difference between RUN-INTERACTIVE and RUN-NONINTERACTIVE is significant. I believe the real problem was a misplaced close bracket in the LET* parameters. This loads the photo then brings up the Print dialogue. Since the settings are preserved, I just need to click "print". A second problem is the gimp batch command. I need to pass a string value (in quotes) but the single quotes didn't allow the expansion correctly. I ended up using this, which allowed the command line call to work snapshot=\"/home/garydale/$1\" gimp -i -b "(printshot $snapshot)" -b "(gimp-quit 0)" My actual full script to take the picture and print it is: #!/bin/sh if [ ! -e cameraset ]; then gphoto2 --set-config imagequality=0 gphoto2 --set-config imagesize=0 touch cameraset fi if [ -e $1 ]; then rm $1 fi gphoto2 --capture-image-and-download --filename=$1 convert $1 -auto-orient -density 544 -shave 136x0 print$1 snapshot=\"/home/garydale/print$1\" gimp -i -b "(printshot $snapshot)" -b "(gimp-quit 0)" |
All times are GMT -5. The time now is 02:25 AM. |