Hello all,

I just joined the list today.  New to using Gimp, but have been using 
Linux/Unix for a long time.   I'm having trouble using command line batch & 
Script-fu, and I'm hoping someone can help.  Maybe this is something 
simple....  (for reference: Gimp 1.2.5 and Linux Mandrake 10)

I'm using a slide duplicator to convert slides to digital using a Canon A70 
camera.  The white balance is not quite right, so in Gimp I'm converting the 
jpg's to tiff's and adding red and subtracted blue in the mid-tones.  Since 
it involves thousands of pictures, it would be great to do this in batch 
mode.  (I tried ImageMagick, but didn't get the colors right.)  I wrote a 
couple script-fu's which run in batch mode.  The JPG to TIFF converter works 
great, but the color changing script only crashes!  (see below for output and 

Here's the general idea:
Usage: "$ mycolors r g b" 
where 'r' = cyan-magenta channel, 'g' = magenta-green channel, 'b' = 
yellow-blue channel.  
Replace r g b with relative value changes for channels, i.e. "mycolors 20 0 
-20" to increase red and decrease blue mid-tones.  Modifies all TIFF files in 
working directory.

        # set variables
        starttime=$( date )

        for filename in *.tiff; do
           # tell me what will happen
           echo "Working on:" $filename 
           # batch gimp change colors
           gimp -c -i -d -b\
                '(script-fu-marcscolors "'$xred'" "'$xgreen'" "'$xblue'" "'$filename'" 
                '(gimp-quit 0)'

        echo "Start time:" $starttime
        echo "End time:  " $( date )

                (script-fu-marcscolors xred xgreen xblue intiff outtiff)
                                (img (car (file-tiff-load 1 intiff intiff)))
                                (drawable (car (gimp-image-active-drawable img)))

                        (gimp-color-balance drawable 1 1 xred xgreen xblue)
                        (file-tiff-save 1 img drawable outtiff outtiff 0)

        (script-fu-register "script-fu-marcscolors"
        "Marc's Colors"
        "Marcus Bryner"
        "Marcus Bryner"
        SF-VALUE "cyan-Red" "0"
        SF-VALUE "Magenta-Green" "0"
        SF-VALUE "Yellow-Blue" "0"
        SF-FILENAME "Infile" "infile.tiff"
        SF-FILENAME "Outfile" "outfile.tiff")

Here's the command-line output:

        $ ./mycolors 20 0 -20

        Working on: IMG_3417.tiff
        batch command: experienced an execution error.


If I leave out the command-line  variables and hard-code them into the script, 
I get:
        batch command: executed successfully.

        Gimp-WARNING **: swap file not empty: "/home/marcus/.gimp-1.2/gimpswap.21221"


What am I doing wrong here????  Thanks in advance!


Marcus A. Bryner, M.D.
Dept. of Radiology
Loma Linda University, CA
Gimp-user mailing list

Reply via email to