Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 12-06-2010, 10:56 AM   #1
Registered: Feb 2007
Posts: 138

Rep: Reputation: 22
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?

Last edited by garydale; 12-08-2010 at 05:51 PM. Reason: corrected typos
Old 12-10-2010, 12:42 PM   #2
Registered: Feb 2007
Posts: 138

Original Poster
Rep: Reputation: 22
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

gimp -i -b "(printshot $snapshot)" -b "(gimp-quit 0)"

My actual full script to take the picture and print it is:

if [ ! -e cameraset ]; then
gphoto2 --set-config imagequality=0
gphoto2 --set-config imagesize=0
touch cameraset
if [ -e $1 ]; then
rm $1
gphoto2 --capture-image-and-download --filename=$1
convert $1 -auto-orient -density 544 -shave 136x0 print$1
gimp -i -b "(printshot $snapshot)" -b "(gimp-quit 0)"


gimp, print

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't print anything from Gimp shame Linux - Software 1 12-17-2006 08:04 AM
EPSON Stylus Photo R200 - CUPS+Gimp-Print v4.2.7 does not print anymore Harp00 Linux - Newbie 1 05-24-2006 10:59 AM
printing on HP PhotoSmart from Gimp 2.2, gimp-print drivers needed? pearman Debian 2 08-05-2005 04:19 AM
gimp / gutenprint prob: gimp does not print bitpicker Linux - Software 0 04-08-2005 07:38 AM
gimp-print Mr Marmmalade Linux - Software 7 06-28-2003 09:11 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:08 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration