Hi all,

I try to write my first script to generate some thumbnails from my
photos with Gimp in batch mode. For better debugging I test it first
from the script-fu console. By correcting some other errors I
discovered, that the script does not get the correct paramters from the
command line.

The call in the script-fu console: (script-fu-sven-scale 1 "014_12.jpg"
"231" "154" "test_thumb.jpg")

causes an error (the cause of the error is not the problem), which shows
that the script receives only the the first and the second paramter
correct

Script-Fu Error while executing
 (script_fu_sven_scale "014_12.jpg" 231 231 "014_12.jpg")
ERROR: too few arguments (see errobj)

When I try the same script in interactive mode:
(script-fu-sven-scale 0 "014_12.jpg" "231" "154" "test_thumb.jpg")

it gets the correct parameters as can be seen in the error console:

Script-Fu Error while executing
 (script_fu_sven_scale "/home/sforner/test/014_12.jpg" 231 154
"/home/sforner/test/test_thumb.jpg")
ERROR: too few arguments (see errobj)

If I add missing argument to the gimp-display-new call the interactive
script works fine, BUT not the noninteractive.
I hope someone can give me an advice, what I'm doing wrong.

The simple script is:

(script-fu-register
 "script_fu_sven_scale"       ;func name
 "<Toolbox>/Xtns/Script-Fu/Utils/Sven scale"   ;menu pos
 "Scales the image to given size"
 "Sven Forner"
 "GPL"
 "Time-stamp: <03.01.02 18:42 sforner>"
 ""                                           ;Image type the script
works on
 SF-FILENAME "The image"  "filename.jpg"
 SF-VALUE "New width:"  "231"                 ;New image width
 SF-VALUE "New height:" "154"                 ;New image height
 SF-FILENAME "Output Filename:" "thumbnail.jpg" ;Output filename
)

(define (script_fu_sven_scale in_file in_width in_height
in_filename_out)
  (let* ((img (car (gimp-file-load 1 in_file in_file)))
         (drawable (car (gimp-image-active-drawable img))))
    (gimp-image-scale img in_width in_height)
    (file-jpeg-save 1 img drawable "test_thumb.jpg" "test_thumb.jpg"
0.75 0 1 1 "Created by Sven" 0 0 0 0)
    (gimp-display-new )
  )
)

Thanks
        Sven
_______________________________________________
Gimp-user mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-user

Reply via email to