Resize Script
I've been finding GIMP (GNU Image Manipulation Program) more and more handy. I now use it at work for product photos and even to prepare photos for flyers.
This is the second Script-Fu script I've made for GIMP. These small shortcuts greatly improve the throughput of my graphics workflow. In my workflow I etch a photo I've shot, stick it on a white background. This is where the scaling comes in. I need to make two images. One 500x500 max and one 64 height max. By using these Script-Fu scripts, it saves a few key strokes and a few clicks as well.
I took the top of Ben Simon's scale and save script to use in my scale script and modified it. Its pretty much identical except I've swapped the width and height fixed values.
Now I've got newlines in the code sample. I'll have to take a copy from my machine and dump it in here. It's a lot nicer looking...
(define (scale-to-fivehundred img drawable) (let* ((orig-width (car (gimp-image-width img))) (orig-height (car (gimp-image-height img))) (dest-width 500) (dest-height (/ (* dest-width orig-height) orig-width)) ) (gimp-drawable-transform-scale-default drawable 0 0 dest-width dest-height TRUE TRANSFORM-RESIZE-CROP) (gimp-image-resize-to-layers img) )) (define (scale-to-sixtyfour img drawable) (let* ((orig-width (car (gimp-image-width img))) (orig-height (car (gimp-image-height img))) (dest-height 64) (dest-width (/ (* dest-height orig-width) orig-height))) (gimp-drawable-transform-scale-default drawable 0 0 dest-width dest-height TRUE TRANSFORM-RESIZE-CROP) (gimp-image-resize-to-layers img) )) (script-fu-register "scale-to-fivehundred" _"Scale to 500w max" "Scale to 500w max" "Tim Dousset" "Sourced from http://benjisimon.blogspot.com/2008/02/earning-my-script-fu-blackbelt.html (Ben Simon)" "2008-03-17" "RGB* GRAY*" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 ) (script-fu-register "scale-to-sixtyfour" _"Scale to 64h max" "Scale to 64h max" "Tim Dousset" "Sourced from http://benjisimon.blogspot.com/2008/02/earning-my-script-fu-blackbelt.html (Ben Simon)" "2008-03-17" "RGB* GRAY*" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 ) (script-fu-menu-register "scale-to-fivehundred" _"<Image>/Script-Fu") (script-fu-menu-register "scale-to-sixtyfour" _"<Image>/Script-Fu")