2006-12-09 13:33:38 -08:00
|
|
|
; GIMP - The GNU Image Manipulation Program
|
1997-11-24 14:05:25 -08:00
|
|
|
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
2006-10-15 18:08:54 -07:00
|
|
|
;
|
1997-11-24 14:05:25 -08:00
|
|
|
; Predator effect
|
|
|
|
|
; Copyright (c) 1997 Adrian Likins
|
|
|
|
|
; aklikins@eos.ncsu.ed
|
|
|
|
|
;
|
2006-10-15 18:08:54 -07:00
|
|
|
; The idea here is too make the image/selection look sort of like
|
1997-11-24 14:05:25 -08:00
|
|
|
; the view the predator had in the movies. ie, kind of a thermogram
|
|
|
|
|
; type of thing. Works best on colorful rgb images.
|
|
|
|
|
;
|
2009-01-17 14:28:01 -08:00
|
|
|
; This program is free software: you can redistribute it and/or modify
|
1997-11-24 14:05:25 -08:00
|
|
|
; it under the terms of the GNU General Public License as published by
|
2009-01-17 14:28:01 -08:00
|
|
|
; the Free Software Foundation; either version 3 of the License, or
|
1997-11-24 14:05:25 -08:00
|
|
|
; (at your option) any later version.
|
2006-10-15 18:08:54 -07:00
|
|
|
;
|
1997-11-24 14:05:25 -08:00
|
|
|
; 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.
|
2006-10-15 18:08:54 -07:00
|
|
|
;
|
1997-11-24 14:05:25 -08:00
|
|
|
; You should have received a copy of the GNU General Public License
|
2018-07-11 14:27:07 -07:00
|
|
|
; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1997-11-24 14:05:25 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (script-fu-predator image
|
2006-10-15 18:08:54 -07:00
|
|
|
drawable
|
|
|
|
|
edge-amount
|
|
|
|
|
pixelize
|
|
|
|
|
pixel-size
|
|
|
|
|
keep-selection
|
|
|
|
|
separate-layer)
|
1997-11-24 14:05:25 -08:00
|
|
|
(let* (
|
2006-10-15 18:08:54 -07:00
|
|
|
(type (car (gimp-drawable-type-with-alpha drawable)))
|
|
|
|
|
(image-width (car (gimp-image-width image)))
|
|
|
|
|
(image-height (car (gimp-image-height image)))
|
2008-01-14 21:15:08 -08:00
|
|
|
(active-selection 0)
|
|
|
|
|
(from-selection 0)
|
|
|
|
|
(selection-bounds 0)
|
|
|
|
|
(select-offset-x 0)
|
|
|
|
|
(select-offset-y 0)
|
|
|
|
|
(select-width 0)
|
|
|
|
|
(select-height 0)
|
|
|
|
|
(effect-layer 0)
|
|
|
|
|
(active-layer 0)
|
2006-10-15 18:08:54 -07:00
|
|
|
)
|
|
|
|
|
|
2011-11-08 23:42:34 -08:00
|
|
|
(gimp-context-push)
|
|
|
|
|
(gimp-context-set-defaults)
|
2003-12-05 06:18:47 -08:00
|
|
|
(gimp-image-undo-group-start image)
|
1997-11-24 14:05:25 -08:00
|
|
|
(gimp-layer-add-alpha drawable)
|
2006-10-15 18:08:54 -07:00
|
|
|
|
1997-11-24 14:05:25 -08:00
|
|
|
(if (= (car (gimp-selection-is-empty image)) TRUE)
|
2006-10-15 18:08:54 -07:00
|
|
|
(begin
|
2011-11-06 12:55:45 -08:00
|
|
|
(gimp-image-select-item image CHANNEL-OP-REPLACE drawable)
|
2006-10-15 18:08:54 -07:00
|
|
|
(set! active-selection (car (gimp-selection-save image)))
|
|
|
|
|
(set! from-selection FALSE)
|
|
|
|
|
)
|
|
|
|
|
(begin
|
|
|
|
|
(set! from-selection TRUE)
|
|
|
|
|
(set! active-selection (car (gimp-selection-save image)))
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
1997-11-24 14:05:25 -08:00
|
|
|
(set! selection-bounds (gimp-selection-bounds image))
|
|
|
|
|
(set! select-offset-x (cadr selection-bounds))
|
|
|
|
|
(set! select-offset-y (caddr selection-bounds))
|
|
|
|
|
(set! select-width (- (cadr (cddr selection-bounds)) select-offset-x))
|
|
|
|
|
(set! select-height (- (caddr (cddr selection-bounds)) select-offset-y))
|
2006-10-15 18:08:54 -07:00
|
|
|
|
2000-04-02 04:39:28 -07:00
|
|
|
(if (= separate-layer TRUE)
|
2006-10-15 18:08:54 -07:00
|
|
|
(begin
|
|
|
|
|
(set! effect-layer (car (gimp-layer-new image
|
|
|
|
|
select-width
|
|
|
|
|
select-height
|
|
|
|
|
type
|
|
|
|
|
"glow layer"
|
|
|
|
|
100
|
2017-01-09 11:37:30 -08:00
|
|
|
LAYER-MODE-NORMAL))
|
2006-10-15 18:08:54 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(gimp-layer-set-offsets effect-layer select-offset-x select-offset-y)
|
2011-03-01 23:55:43 -08:00
|
|
|
(gimp-image-insert-layer image effect-layer 0 -1)
|
2006-10-15 18:08:54 -07:00
|
|
|
(gimp-selection-none image)
|
2018-04-16 11:12:12 -07:00
|
|
|
(gimp-drawable-edit-clear effect-layer)
|
2006-10-15 18:08:54 -07:00
|
|
|
|
2011-11-06 12:55:45 -08:00
|
|
|
(gimp-image-select-item image CHANNEL-OP-REPLACE active-selection)
|
2006-10-15 18:08:54 -07:00
|
|
|
(gimp-edit-copy drawable)
|
|
|
|
|
(let ((floating-sel (car (gimp-edit-paste effect-layer FALSE))))
|
|
|
|
|
(gimp-floating-sel-anchor floating-sel)
|
|
|
|
|
)
|
2006-10-20 10:55:14 -07:00
|
|
|
(gimp-image-set-active-layer image effect-layer)
|
2006-10-15 18:08:54 -07:00
|
|
|
)
|
|
|
|
|
(set! effect-layer drawable)
|
2004-10-04 02:02:00 -07:00
|
|
|
)
|
|
|
|
|
(set! active-layer effect-layer)
|
1997-11-24 14:05:25 -08:00
|
|
|
|
|
|
|
|
; all the fun stuff goes here
|
|
|
|
|
(if (= pixelize TRUE)
|
2007-10-01 12:44:23 -07:00
|
|
|
(plug-in-pixelize RUN-NONINTERACTIVE image active-layer pixel-size)
|
2006-10-15 18:08:54 -07:00
|
|
|
)
|
2007-10-01 12:44:23 -07:00
|
|
|
(plug-in-max-rgb RUN-NONINTERACTIVE image active-layer 0)
|
|
|
|
|
(plug-in-edge RUN-NONINTERACTIVE image active-layer edge-amount 1 0)
|
2006-10-15 18:08:54 -07:00
|
|
|
|
1997-11-24 14:05:25 -08:00
|
|
|
; clean up the selection copy
|
2011-11-06 12:55:45 -08:00
|
|
|
(gimp-image-select-item image CHANNEL-OP-REPLACE active-selection)
|
2006-10-15 18:08:54 -07:00
|
|
|
|
1997-11-24 14:05:25 -08:00
|
|
|
(if (= keep-selection FALSE)
|
2006-10-15 18:08:54 -07:00
|
|
|
(gimp-selection-none image)
|
|
|
|
|
)
|
|
|
|
|
|
1997-11-24 14:05:25 -08:00
|
|
|
(gimp-image-set-active-layer image drawable)
|
|
|
|
|
(gimp-image-remove-channel image active-selection)
|
2003-12-05 06:18:47 -08:00
|
|
|
(gimp-image-undo-group-end image)
|
2006-10-15 18:08:54 -07:00
|
|
|
(gimp-displays-flush)
|
2011-11-08 23:42:34 -08:00
|
|
|
(gimp-context-pop)
|
2006-10-15 18:08:54 -07:00
|
|
|
)
|
|
|
|
|
)
|
1997-11-24 14:05:25 -08:00
|
|
|
|
|
|
|
|
(script-fu-register "script-fu-predator"
|
2006-10-15 18:08:54 -07:00
|
|
|
_"_Predator..."
|
|
|
|
|
_"Add a 'Predator' effect to the selected region (or alpha)"
|
|
|
|
|
"Adrian Likins <adrian@gimp.org>"
|
|
|
|
|
"Adrian Likins"
|
|
|
|
|
"10/12/97"
|
|
|
|
|
"RGB*"
|
|
|
|
|
SF-IMAGE "Image" 0
|
|
|
|
|
SF-DRAWABLE "Drawable" 0
|
|
|
|
|
SF-ADJUSTMENT _"Edge amount" '(2 0 24 1 1 0 0)
|
|
|
|
|
SF-TOGGLE _"Pixelize" TRUE
|
|
|
|
|
SF-ADJUSTMENT _"Pixel amount" '(3 1 16 1 1 0 0)
|
|
|
|
|
SF-TOGGLE _"Keep selection" TRUE
|
|
|
|
|
SF-TOGGLE _"Separate layer" TRUE
|
|
|
|
|
)
|
2004-11-18 14:44:28 -08:00
|
|
|
|
|
|
|
|
(script-fu-menu-register "script-fu-predator"
|
2006-10-15 18:08:54 -07:00
|
|
|
"<Image>/Filters/Artistic")
|