Probably an old question, but since I am new to this list I just post it.
How do I batch process files in gimp and resize the images while keeping
the aspect ratio of the original file. I modified the batch processing
example on the Gimp web pages, but it just doesn't work.
I have included the modified script below. As you can see I try to
resize the images to a maximum size of 1920x1200px.

(define (batch-unsharp-mask pattern
  (let* ((filelist (cadr (file-glob pattern 1))))
    (while (not (null? filelist))
           (let* ((filename (car filelist))
                  (image (car (gimp-file-load RUN-NONINTERACTIVE
                                              filename filename)))
                  (drawable (car (gimp-image-get-active-layer image)))
                  (width (car(gimp-image-width image)))
                  (height (car(gimp-image-height image)))
                  (scale min( (/ 1920 width) (/ 1200 height)))
                  (xsize (* scale width))
                  (ysize (* scale height)))
             (plug-in-unsharp-mask RUN-NONINTERACTIVE
                                   image drawable radius amount threshold)
             (gimp-image-scale image (floor xsize) (floor ysize))
             (gimp-file-save RUN-NONINTERACTIVE
                             image drawable filename filename)
             (gimp-image-delete image))
           (set! filelist (cdr filelist)))))


Kind regards / Vriendelijke groeten,

Eric van Oorschot
Gimp-user mailing list

Reply via email to