; ; poster.scm - quick and easy posterization ; ; ;;; -------------------------------------------------------------------- ;;; version 0.1 by Jeff Trefftzs ;;; - Initial relase ;;; version 0.2 Raymond Ostertag ;;; - ported to Gimp 2.0, 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. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Helper function to create a new layer ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (copylayer layer layername) (set! new (car(gimp-layer-copy layer 1))) ; Add an alpha channel (gimp-drawable-set-name new layername) new ) ; Now, the real function . . . (define (script-fu-poster inImage inLayer) (let* ( (posterlayer (copylayer inLayer "Poster Layer")) ) (gimp-image-undo-group-start inImage) (gimp-image-add-layer inImage posterlayer -1) (gimp-layer-set-mode posterlayer 14) ; VALUE-MODE (gimp-desaturate posterlayer) (gimp-posterize posterlayer 4) ; 4 levels (=64 colors) ) (gimp-image-set-active-layer inImage inLayer) (gimp-image-undo-group-end inImage) (gimp-displays-flush) ) (script-fu-register "script-fu-poster" _"/Script-Fu/Alchemy/Poster" "Converts an image into a poster by placing a posterized, desaturated copy of the original in value mode over the original image. This implements a technique posted by Guillermo Romero to the Gimp-user mailing list." "Jeff Trefftzs" "Copyright 2001, Jeff Trefftzs" "March 31, 2001" "RGB* GRAY* INDEXED*" SF-IMAGE "The Image" 0 SF-DRAWABLE "The Layer" 0 )