; PDA shrink ; Shrinks and saves the current image in a single step. ; It overwrites the original. ; The image will not be stretched, but will be as large as ; possible within the size limits you set. (define (script-fu-PDA-Image-Shrink img drawable width height) (let* ((imgWidth (car (gimp-image-width img))) (imgHeight (car (gimp-image-height img))) (newHeight 10) (newWidth 10) (fname (car (gimp-image-get-filename img)))) (if (<= imgWidth imgHeight) (begin (set! newHeight height) (set! newWidth (* imgWidth (/ newHeight imgHeight) )) ) ) (if (< imgHeight imgWidth) (begin (set! newWidth width) (set! newHeight (* imgHeight (/ newWidth imgWidth) )) ) ) (gimp-image-scale img newWidth newHeight) (gimp-file-save 1 img drawable fname fname) (gimp-image-clean-all img) ) ) (script-fu-register "script-fu-PDA-Image-Shrink" _"_PDA Shrink..." "Shrink Images to PDA Size. Maintains aspect ratio optimized to given width/height." "Derek Duban" "" "August 2005" "" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-ADJUSTMENT _"Fit Image Width" '(256 16 1024 1 10 0 1) SF-ADJUSTMENT _"Fit Image Height" '(256 16 768 1 10 0 1)) (script-fu-menu-register "script-fu-PDA-Image-Shrink" _"/Xtns/Script-Fu/Utils")