GIMP Script-fu

Artifact Content
Login

Artifact ef32a45f51142a506b8b9abef770fc2cb95c14d0:


; 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.

(unless (defined? 'gimp-image-insert-item)
  (define (gimp-image-insert-item image layer ignored pos)
    (gimp-image-add-layer image layer pos) )
  (define gimp-item-set-name gimp-drawable-set-name) )

(define (script-fu-sg-tone-map1 image layer)
  (gimp-image-undo-group-start image)
  (let ((lum-layer (car (gimp-layer-copy layer TRUE)))
        (orig-sel (car (gimp-selection-save image))) )
    (gimp-image-set-active-layer image layer)
    (gimp-image-insert-item image lum-layer 0 -1)
    (plug-in-colors-channel-mixer RUN-NONINTERACTIVE image lum-layer FALSE
                                  0.21 0.72 0.07
                                  0.21 0.72 0.07
                                  0.21 0.72 0.07 )
    (gimp-invert lum-layer)
    (plug-in-gauss RUN-NONINTERACTIVE image lum-layer 10 10 0)
    (gimp-layer-set-mode lum-layer OVERLAY-MODE)
    (gimp-item-set-name lum-layer "Tone Map")
    (gimp-selection-load orig-sel)
    (gimp-image-remove-channel image orig-sel) )
  (gimp-image-undo-group-end image) )

(script-fu-register "script-fu-sg-tone-map1"
  "Tone Map 1"
  "Create a tone map layer per smithaa02"
  "Saul Goode"
  "Saul Goode"
  "June 2013"
  "RGB*"
  SF-IMAGE    "Image"    0
  SF-DRAWABLE "Layer"    0
  )

(script-fu-menu-register "script-fu-sg-tone-map1"
  "<Image>/Filters/Artistic" )

(define (script-fu-sg-tone-map2 image layer)
  (gimp-image-undo-group-start image)
  (let ((lum-layer (car (gimp-layer-copy layer TRUE)))
        (tmp-layer (car (gimp-layer-copy layer TRUE)))
        (orig-sel (car (gimp-selection-save image))) )
    (gimp-image-set-active-layer image layer)
    (gimp-image-insert-item image tmp-layer 0 -1)
    (gimp-image-insert-item image lum-layer 0 -1)
    (plug-in-colors-channel-mixer RUN-NONINTERACTIVE image lum-layer FALSE
                                  0.21 0.72 0.07
                                  0.21 0.72 0.07
                                  0.21 0.72 0.07 )
    (gimp-invert lum-layer)
    (plug-in-gauss RUN-NONINTERACTIVE image lum-layer 10 10 0)
    (gimp-layer-set-opacity lum-layer 60)
    (set! lum-layer (car (gimp-image-merge-down image lum-layer EXPAND-AS-NECESSARY)))
    (gimp-layer-set-mode lum-layer OVERLAY-MODE)
    (gimp-item-set-name lum-layer "Tone Map")
    (gimp-selection-load orig-sel)
    (gimp-image-remove-channel image orig-sel) )
  (gimp-image-undo-group-end image) )


(script-fu-register "script-fu-sg-tone-map2"
  "Tone Map 2"
  "Create a tone map layer per smithaa02"
  "Saul Goode"
  "Saul Goode"
  "June 2013"
  "RGB*"
  SF-IMAGE    "Image"    0
  SF-DRAWABLE "Layer"    0
  )

(script-fu-menu-register "script-fu-sg-tone-map2"
  "<Image>/Filters/Artistic" )