Tag Archives: gimp

GIMP Script: script-fu-highlight

(define (script-fu-highlight image
                             drawable
                             padding
                             shadow)
  (if (= (car (gimp-selection-is-empty image)) TRUE)
      (gimp-message "Select an area to highlight.")
      (let ((selection 0))
        (gimp-undo-push-group-start image)
        (set! selection (car (gimp-selection-save image)))
        (gimp-selection-grow image (/ padding 2))
        (gimp-selection-feather image padding)
        (gimp-selection-invert image)
        (gimp-levels drawable HISTOGRAM-VALUE 0 255 1 0 shadow)
        (gimp-image-select-item image CHANNEL-OP-REPLACE selection)
        (gimp-image-remove-channel image selection)
        (gimp-undo-push-group-end image)
        (gimp-displays-flush))))

(script-fu-register "script-fu-highlight"
                    "_Highlight..."
                    "Highlight the current selection"
                    "Steven Williams"
                    "Steven Williams"
                    "2014"
                    "RGB* GRAY*"
                    SF-IMAGE "Image" 0
                    SF-DRAWABLE "Layer" 0
                    SF-ADJUSTMENT "Padding" '(10 0 100 1 10 0 SF-SPINNER)
                    SF-ADJUSTMENT "Shadow" '(127 0 255 1 10 0 SF-SLIDER))
(script-fu-menu-register "script-fu-highlight" "<Image>/Filters/Light and Shadow/Light")

Output: