I tried to change the script but i am a newbie at scripting. I managed to run the script without errors but also without result.. Please help
; Resize Stairstep
; Author: Igor Birman
; Date: 08/03/2005
; Version: 1.0
; This script will resize an image in several steps to give the sharpest
; possible resized image. An image can be scaled up or down using this
; technique. 8-12 steps is considered to be the optimum amount.
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
(define (resize-stairstep img
drawable
new-width
number-of-steps)
; Start an undo group. Everything between the start and the end will
; be carried out if an undo command is issued.
(gimp-image-undo-group-start img)
; Select the entire image
(gimp-selection-all img)
(let* ( (selection-bounds 0) (x1 0) (y1 0) (x2 0) (y2 0) (w 0) (h 0) (step 0) (width 0) (height 0) (ratio 0) (new-width 0) )
; Retrieve the current dimensions of the image
(set! selection-bounds (gimp-selection-bounds img))
(set! x1 (cadr selection-bounds))
(set! y1 (caddr selection-bounds))
(set! x2 (- (cadr (cddr selection-bounds)) x1))
(set! y2 (- (caddr (cddr selection-bounds)) y1))
; De-select the selection
(gimp-selection-none img)
; Start a let group
(let*
(
; Calculate current and new width, height, ratio, and step size
(width (- x2 x1))
(height (- y2 y1))
(ratio (/ height width))
(step (/ (- width new-width) number-of-steps))
(w width)
(h 0)
)
)
; Loop until the image is the desired size
(while (not (= w new-width))
(set! w (- w step))
; Allow for rounding, do not make it smaller than needed.
; If decreasing the size of the image..
(if (< new-width width)
(if (< w new-width)
(set! w new-width)
)
)
; If increasing the size of the image..
(if (> new-width width)
(if (> w new-width)
(set! w new-width)
)
)
; Set new height based on width times ratio
(set! h (* w ratio))
; Increase the canvas size to the new size if increasing image
(if (> new-width width)
(gimp-image-resize img w h 0 0)
)
; Scale the image to the new width and height
(gimp-drawable-transform-scale drawable 0 0 w h 0 2 0 3 0)
; Crop the image down to the new scaled size
(if (< new-width width)
(gimp-image-crop img w h 0 0)
)
; Re-display the cropped image
(gimp-displays-flush)
)
; Remove any existing selections
(gimp-selection-none img)
; Stop the undo group.
(gimp-image-undo-group-end img)
; Flush the display to show changes
(gimp-displays-flush)
)
)
(script-fu-register "resize-stairstep"
_"<Image>/Script-Fu/Misc/Resize by Steps"
"Resize an image by steps"
"Igor Birman"
"Igor Birman"
"August 3, 2005"
""
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-VALUE "Target Width" "1024"
SF-ADJUSTMENT "Number of Steps" '(3 2 12 1 1 1 1)
)

Help












