; lab-colorboost.scm ; ; Version 0.1 October 2007 ; ; ; lab-colorboost implements the color boost idea here: ; http://www.dslreports.com/forum/remark,15173919 ; ; This file should be put into your GIMP scripts directory. Probably ; something like ~/.gimp/scripts or ~/.gimp-2.2/scripts (this is where ; mine is--I'm on Debian Lenny/Sid). ; ;############################################################################## ; ; LICENSE ; ; Copyright (C) 2007 Ben Rasmussen ; ; lab-colorboost 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, or (at ; your option) any later version. ; ; lab-colorboost 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 lab-colorboost; see the file COPYING. If not, write to ; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ; Floor, Boston, MA 02110-1301, USA. ; ;############################################################################## (define (script-fu-lab-colorboost image drawable opacity ) (set! drawable (car (gimp-image-get-active-layer image))) ;decompose to new lab image (set! labimage (car (plug-in-decompose RUN-NONINTERACTIVE image drawable "LAB" 1))) ;create array of layers (set! lablayers (gimp-image-get-layers labimage)) (set! b_layer (aref (cadr lablayers) 0)) (set! a_layer (aref (cadr lablayers) 1)) (set! l_layer (aref (cadr lablayers) 2)) ;dupe layer 'B', set to overlay and merge down (gimp-image-set-active-layer labimage b_layer) (set! copy (car (gimp-layer-copy b_layer 1))) (set! newlayer (car (gimp-image-add-layer labimage copy -1))) (set! drawable (car (gimp-image-get-active-layer labimage))) (gimp-layer-set-mode drawable 5) (gimp-image-merge-down labimage drawable 0) ;dupe layer 'A', set to overlay and merge down (gimp-image-set-active-layer labimage a_layer) (set! copy (car (gimp-layer-copy a_layer 1))) (set! newlayer (car (gimp-image-add-layer labimage copy -1))) (set! drawable (car (gimp-image-get-active-layer labimage))) (gimp-layer-set-mode drawable 5) (gimp-image-merge-down labimage drawable 0) ;merging changes layer id, so reset (set! lablayers (gimp-image-get-layers labimage)) (set! b_layer (aref (cadr lablayers) 0)) (set! a_layer (aref (cadr lablayers) 1)) (set! l_layer (aref (cadr lablayers) 2)) ;compose to new image (set! composeimage (car (plug-in-drawable-compose 1 labimage l_layer a_layer b_layer drawable "LAB"))) ;copy composed image to new layer on original image (set! drawable (car (gimp-image-get-active-layer composeimage))) (set! copy (car (gimp-layer-new-from-drawable drawable image))) (set! newlayer (car (gimp-image-add-layer image copy -1))) ;clean up tmp images (gimp-image-delete labimage) (gimp-image-delete composeimage) (gimp-displays-flush) (set! drawable (car (gimp-image-get-active-layer image))) (gimp-layer-set-opacity drawable opacity) ) (script-fu-register "script-fu-lab-colorboost" _"_LAB Colorboost" "Gives a boost to colors using LAB image mode" "Ben Rasmussen " "Ben Rasmussen" "10/5/2007" "RGB* GRAY*" SF-IMAGE "Input image" 0 SF-DRAWABLE "Input drawable" 0 SF-ADJUSTMENT "Opacity" '(30 1 100 1 10 0 1)) (script-fu-menu-register "script-fu-lab-colorboost" _"/Script-Fu/Decor")