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
code)
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.
THE SCRIPT:
************************************
# set variables
starttime=$( date )
xred=$1
xgreen=$2
xblue=$3
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'"
"'$filename'")'\
'(gimp-quit 0)'
done
echo "Start time:" $starttime
echo "End time: " $( date )
*************************************
THE SCM FILE
*****************************************
(define
(script-fu-marcscolors xred xgreen xblue intiff outtiff)
(let*
(
(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"
"/Xtns/Script-Fu/Tools/marcscolors"
"Marc's Colors"
"Marcus Bryner"
"Marcus Bryner"
"2001-10-09"
""
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