; ?2001 Doug Reynolds. Code taken verbatim from: ; http://lists.xcf.berkeley.edu/lists/gimp-user/2006-May/008022.html ; Write a watermark in a corner of the image (define (script-fu-rs-center-crop filename outfilename width height) (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (drawable (car (gimp-image-get-active-layer image)))) (let* ((original-width (car (gimp-image-width image))) (original-height (car (gimp-image-height image))) ) (if (<= (/ original-width original-height) (/ width height)) (gimp-image-crop image original-width (* original-width (/ height width)) 0 (/ (- original-height (* original-width (/ height width))) 2) ) (gimp-image-crop image (* original-height (/ width height)) original-height (/ (- original-width (* original-height (/ width height))) 2) 0) ) ) (set! drawable (car (gimp-image-get-active-layer image))) (gimp-file-save RUN-NONINTERACTIVE image drawable outfilename outfilename) (gimp-image-delete image)))