; The GIMP -- an image manipulation program ; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; ; ANMCD2/Cover script -- Rescale an image in order to fit into a square. ; ; Copyright (C) 1997 Marco Lamberto ; lm@geocities.com ; http://www.geocities.com/Tokyo/1474/gimp/ ; ; $Revision: 1.4 $ ; Version 2.0 Raymond Ostertag 2004/12 ; - Ported to Gimp2, changed menu entry ; ; 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. ; ANMCD 2 Cover Generator ! (define (script-fu-anmcd2cov image drawable size bg) (set! w (car (gimp-drawable-width drawable))) (set! h (car (gimp-drawable-height drawable))) (set! w2 size) (set! h2 size) (if (= (car (gimp-drawable-is-indexed drawable)) TRUE) (gimp-image-convert-rgb image)) (cond ((<= w h) (set! w2 (/ (* w size) h)) ) ((> w h) (set! h2 (/ (* h size) w)) )) (gimp-image-scale image w2 h2) (gimp-image-resize image size size (/ (- size w2) 2) (/ (- size h2) 2)) (set! old-bg (car (gimp-palette-get-background))) (gimp-palette-set-background bg) (gimp-image-flatten image) (gimp-palette-set-background old-bg) (gimp-displays-flush)) (script-fu-register "script-fu-anmcd2cov" "/Script-Fu/Utils/Square scale" "Rescale an image in order to fit into a square." "Marco Lamberto " "Marco Lamberto" "20 Sep 1997 - 30 Aug 1998" "RGB, INDEXED" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-VALUE "Square Size" "190" SF-COLOR "Background Color" '(0 0 0))