RSS/Atom feed Twitter
Site is read-only, email is disabled

Trouble with command line batch & Script-fu

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

2 of 2 messages available
Toggle history

Please log in to manage your subscriptions.

Trouble with command line batch & Script-fu Marcus Bryner 10 Oct 01:58
  Trouble with command line batch & Script-fu Sven Neumann 10 Oct 12:16
Marcus Bryner
2004-10-10 01:58:24 UTC (over 19 years ago)

Trouble with command line batch & Script-fu

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

Sven Neumann
2004-10-10 12:16:50 UTC (over 19 years ago)

Trouble with command line batch & Script-fu

Hi,

Marcus Bryner writes:

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'd suggest you try GIMP 2.0.5 instead. GIMP 1.2 isn't any longer supported and there are hundreds if not thousands of bugs that have been fixed in GIMP 2.0.

Sven