I'm trying to write a script to create a thumbnail for a picture and I have a problem.
I've been searching for hours, but I just can't figure out why I always get the error "Procedure execution of file-jpeg-save failed on invalid input arguments".
I use a similar script for cropping dvd covers and I have no problems saving with it, but for some reason, it won't work here.
I tried to manually enter every parameters I could to eliminate a bad variable, but it changed nothing. I even tried the picture I'm using to test it with my other script and it works perfectly so the problem is not the source.
Here's the script(the only parameter is the filename without the .jpg) and I hope someone can figure out what the problem is:
(define (thumb_maker jpegname)
(let* (
(input (string-append "F:/_Photos/" jpegname ".jpg"))
(output (string-append "F:/_Photos/" jpegname "_thumb.jpg"))
(image (car (file-jpeg-load 1 input output)))
(width (car (gimp-image-width image)))
(height (car (gimp-image-height image)))
(q)(r)(x)(y)(drawable)
)
;Set the jpeg quality
(set! q 85)
;Set the new height
(set! y 150)
;Calculate the scale ratio
(set! r (/ height y))
;Calculate the new width
(set! x (trunc (/ width r)))
;Resize the image
(gimp-image-scale image x y)
;Update drawable
(set! drawable (car (gimp-image-get-active-drawable image)))
;Save in jpeg
(file-jpeg-save 1 image drawable output output q 0 1 0 "" 0 1 0 0)))