; Tonemapping is a script for The GIMP ; ; Reduce global contrast while increasing local contrast and shadow/highlight ; detail. ; ; The script is located in menu " / Script-Fu / Second / Name" ; ; Last changed: 5 August 2007 ; ; Copyright (C) 2007 Harry Phillips ; ; -------------------------------------------------------------------- ; ; Changelog: ; Version 1.4 (8th August 2007) ; - Added option to flatten the result ; ; Version 1.3 (5th August 2007) ; - Added GPL3 licence ; - Menu location at the top of the script ; - Removed the "script-fu-menu-register" section ; ; Version 1.2 ; - Made the script compatible with GIMP 2.3 ; ; -------------------------------------------------------------------- ; ; 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 3 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, you can view the GNU General Public ; License version 3 at the web site http://www.gnu.org/licenses/gpl-3.0.html ; Alternatively you can write to the Free Software Foundation, Inc., 675 Mass ; Ave, Cambridge, MA 02139, USA. ; ; (define (my-duplicate-layer image layer) (let* ((dup-layer (car (gimp-layer-copy layer 1)))) (gimp-image-add-layer image dup-layer 0) dup-layer)) (define (script-fu-liquid-collage Ratio inFile inFilerest outFile) ;Start an undo group so the process can be undone with one undo (let* ( (theImage (car (gimp-file-load 1 inFile inFile))) (theLayer (car (gimp-image-get-active-layer theImage))) (theWLayer (car (gimp-file-load-layer 1 theImage inFilerest))) (w (car (gimp-image-width theImage))) (h (car (gimp-image-height theImage))) ) (set! w (/ (* w Ratio) 100)) (set! h (/ (* h Ratio) 100)) (gimp-image-undo-group-start theImage) (gimp-image-add-layer theImage theWLayer 0) (plug-in-lqr RUN-NONINTERACTIVE ;(INT "run-mode" "Interactive, non-interactive") theImage ;(IMAGE "image" "Input image") 0 ;(DRAWABLE "drawable" "Input drawable") w ;(INT "width" "Final width") h ;(INT "height" "Final height") 0 ;(INT "pres-layer" "Layer that marks preserved areas") 0 ;(INT "pres-coeff" "Preservation coefficient (for interactive mode only)") 1 ;(INT "disc-layer" "Layer that marks areas to discard") 220 ;(INT "disc-coeff" "Discard coefficient") 0 ;(FLOAT "rigidity" "Rigidity coefficient") 0 ;(INT "rigmask-layer" "Layer used as rigidity mask") 1 ;(INT "delta-x" "max displacement of seams") 150 ;(FLOAT "enl-step" "enlargment step (ratio)") 1 ;(INT "resize-aux-layers" "Whether to resize auxiliary layers") 1 ;(INT "resize-canvas" "Whether to resize canvas") 0 ;(INT "new-layer" "Whether to output on a new layer") 0 ;(INT "seams" "Whether to output the seam map") 3 ;(INT "grad-func" "Gradient function to use") 0 ;(INT "res-order" "Resize order") 0 ;(INT "mask-behavior" "What to do with masks") 0 ;(INT "scaleback" "Whether to scale back when done") 0 ;(INT "scaleback-mode" "Scale back mode") 1 ;(INT "no-disc-on-enlarge" "Ignore discard layer upon enlargement") "" ;(STRING "pres-layer-name" "Preservation layer name (overcomes pres-layer)") "restlow.jpg" ;(STRING "disc-layer-name" "Discard layer name (overcomes disc-layer)") "" ;(STRING "rigmask-layer-name" "Rigidity mask layer name (overcomes rigmask-layer)") "Background" ;(STRING "selected-layer-name" "Selected layer name (overcomes the active layer)")) ) (set! theLayer (car (gimp-image-get-active-layer theImage))) ;Finish the undo group for the process (gimp-image-undo-group-end theImage) (gimp-file-save 1 theImage theLayer outFile "") ) ;Ensure the updated image is displayed now (gimp-quit 1) ) (script-fu-register "script-fu-liquid-collage" _"/Image/vilda kus..." "Performs a tone mapping operation with a specified blur on the open image" "David Meiklejohn, Harry Phillips (Process)" "2006, David Meiklejohn, Harry Phillips (Process)" "Feb. 02 2006" "*" SF-ADJUSTMENT "Scale ratio:" '(80 10 200 1 10 0 0) SF-STRING "inputfile:" "Text Box" ;a string variable SF-STRING "inputfile rest:" "Text Box" ;a string variable SF-STRING "outputfile:" "Text Box" ;a string variable )