; The GIMP -- an image manipulation program ; Copyright (C) 1995 Spencer Kimball and Peter Mattis ; ; Crop from the rectangular selection for GIMP 1.2 (;1.3) ; Copyright (C) 2003 mpro ; -------------------------------------------------------------------- ; version 0.2 by sverak_net 2003/11/12 ; add unselection after crop, prepared for GIMP 1.3 ; ; version 0.1 by mpro 2003/11/11 ; - Initial relase ; -------------------------------------------------------------------- ; ; 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 (script-fu-crop-from-selecton image) (set! selection-bounds (gimp-selection-bounds image)) (set! select-offset-x (cadr selection-bounds)) (set! select-offset-y (caddr selection-bounds)) (set! selection-width (- (cadr (cddr selection-bounds)) select-offset-x)) (set! selection-height (- (caddr (cddr selection-bounds)) select-offset-y)) (gimp-undo-push-group-start image) ; this code is for GIMP 1.2, for 1.3 please comment next line (gimp-crop image selection-width selection-height select-offset-x select-offset-y) ; code prepared for GIMP 1.3, ; please uncoment next line in GIMP 1.3 ; (gimp-image-crop image selection-width selection-height select-offset-x select-offset-y) (gimp-selection-none image) (gimp-undo-push-group-end image) (gimp-displays-flush) ) ; Register the function with the GIMP: (script-fu-register "script-fu-crop-from-selecton" _"/Script-Fu/Selection/Crop From Selection" "Crop an image from the rectangular selection." "mpro " "mpro" "2003, Nov" "RGB* GRAY* INDEXED*" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 ) ;---end of file crop_from_selection.scm---