autoresize - resize image using script-fu gimp -


i'm trying prepare script auto-resizing image files. found link cannot figure out how use it.

anyone can provide working script can use starting point?

the following function resizes image:

(define (resize-image filename-in filename-out new-width new-height)   (let* ((image    (car (gimp-file-load run-noninteractive filename-in "")))          (drawable (car (gimp-image-active-drawable image)))         )       (gimp-image-scale image new-width new-height)      (gimp-file-save   run-noninteractive image drawable filename-out "")   ) ) 

now, resizing jpg's in directory:

(define (file-basename filename)   (let*     (       (broken-up (strbreakup filename "."))       (wo-last-r (cdr (reverse broken-up)))       (wo-last   (reverse wo-last-r))       (result "")     )     (while wo-last       (set! result (string-append result (car wo-last) ))       (set! wo-last (cdr wo-last))       (if (> (length wo-last) 0) (set! result (string-append result ".")))     )     result   ) )  (define (ex_09 file-pattern new-width new-height )    (let* ( (filelist (cadr (file-glob file-pattern 1))))      (while (not (null? filelist))       (let* ( (cur-file  (car filelist)) )          (resize-image             cur-file             (string-append (file-basename cur-file) "_resized.jpg")            100             100         )          (set! filelist (cdr filelist))       )     )   ) ) 

i think answer.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -