; Wax Seal - create wax-seal-looking object from original picture ; Copyright (C) 1998 by Jaroslav Benkovsky ; ; Version: 0.1 ; ; Requires: ; plug-in-plasma ; plug-in-emboss ; plug-in-gauss-rle ; ; source image is rgb or grayscale, with black-on-white picture ; ; Changed on June 15, 2000 by Kevin Cozens ; Updated for GIMP 1.1.26 ; ; Changed on January 29, 2004 by Kevin Cozens ; Updated for GIMP 2.0pre3 (define (script-fu-wax-seal img drawable wax-color light-azimuth light-elevation light-depth border-thickness border-threshold inner-hollow? symbol-separate? symbol-thickness bump? bump-granularity bump-smoothness bump-seed) (let* ((width (car (gimp-drawable-width drawable))) (height (car (gimp-drawable-height drawable))) (aliassel TRUE) (old-fg (car (gimp-context-get-foreground))) (old-bg (car (gimp-context-get-background))) (type (car (gimp-drawable-type drawable))) (alpha-type (cond ((= type RGB-IMAGE) RGBA-IMAGE) ((= type RGBA-IMAGE) RGBA-IMAGE) ((= type GRAY-IMAGE) GRAYA-IMAGE) ((= type GRAYA-IMAGE) GRAYA-IMAGE))) (color-layer (car (gimp-layer-new img width height alpha-type "color layer" 100 NORMAL-MODE))) (mask-layer (car (gimp-layer-new img width height alpha-type "mask layer" 100 NORMAL-MODE))) (symbol-layer (car (gimp-layer-copy drawable TRUE))) ) ; setup (gimp-image-undo-disable img) (gimp-selection-none img) (gimp-context-set-foreground '(0 0 0)) (gimp-context-set-background '(255 255 255)) ; separating inner symbol (if (= symbol-separate? TRUE) (begin (gimp-image-add-layer img symbol-layer -1) (gimp-fuzzy-select symbol-layer 1 1 (* 3 border-threshold) CHANNEL-OP-ADD TRUE FALSE 0 FALSE) (gimp-selection-grow img 1) (gimp-edit-bucket-fill symbol-layer FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0) (gimp-selection-none img) (gimp-fuzzy-select symbol-layer 1 1 (* 3 border-threshold) CHANNEL-OP-ADD TRUE FALSE 0 FALSE) (gimp-selection-grow img 1) (gimp-by-color-select symbol-layer '(255 255 255) (* 0.3 border-threshold) CHANNEL-OP-ADD FALSE FALSE 0 FALSE) (gimp-edit-clear symbol-layer) (gimp-selection-invert img) (gimp-edit-bucket-fill drawable BG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0) (gimp-selection-none img) (if (> symbol-thickness 0) (plug-in-gauss-rle 1 img symbol-layer symbol-thickness TRUE TRUE)) )) ; prepare seal border for emboss (if (> border-thickness 0) (plug-in-gauss-rle 1 img drawable border-thickness TRUE TRUE)) ; bumping seal top surface (if (= bump? TRUE) (begin (gimp-image-add-layer img mask-layer -1) (gimp-drawable-fill mask-layer WHITE-FILL) (set! maska (car (gimp-layer-create-mask mask-layer ADD-WHITE-MASK))) (gimp-layer-add-mask mask-layer maska) (plug-in-plasma 1 img maska bump-seed bump-granularity) (if (> bump-smoothness 0) (plug-in-gauss-rle 1 img maska bump-smoothness TRUE TRUE)) (gimp-layer-set-opacity mask-layer 50) (set! drawable (car (gimp-image-flatten img))) (gimp-brightness-contrast drawable 30 60) )) ; reincluding inner symbol (if (= symbol-separate? TRUE) (set! drawable (car (gimp-image-flatten img))) ) ; embossing the seal - monochrome (if (= inner-hollow? FALSE) (begin (gimp-fuzzy-select drawable 1 1 border-threshold CHANNEL-OP-ADD TRUE FALSE 0 FALSE)) (begin (gimp-by-color-select drawable '(255 255 255) border-threshold CHANNEL-OP-ADD TRUE FALSE 0 FALSE))) (gimp-selection-invert img) (plug-in-emboss 1 img drawable light-azimuth light-elevation light-depth TRUE) ; create layer with wax color - colorize the seal (gimp-layer-add-alpha drawable) (gimp-layer-set-mode drawable VALUE-MODE) (gimp-drawable-set-name drawable "seal layer") (gimp-image-add-layer img color-layer 1) (gimp-edit-clear color-layer) (gimp-context-set-foreground wax-color) (gimp-edit-bucket-fill color-layer FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0) (gimp-image-merge-visible-layers img EXPAND-AS-NECESSARY) ; cleanup (gimp-selection-none img) (gimp-context-set-foreground old-fg) (gimp-context-set-background old-bg) (gimp-image-undo-enable img) (gimp-displays-flush) )) (script-fu-register "script-fu-wax-seal" "/Script-Fu/Stencil Ops/Wax Seal" "Create wax-seal (or plasticine) looking object from original image. The image should be black on white, not blurred, and should not be too close to image bounds." "Jaroslav Benkovsky " "Jaroslav Benkovsky" "February 1998" "RGB*, GRAY*" SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-COLOR "Wax Color" '(170 13 13) SF-VALUE "Light Azimuth" "315" SF-VALUE "Light Elevation" "45" SF-VALUE "Light Depth" "20" SF-VALUE "Border Thickness" "20" SF-VALUE "Border Thresholdsel" "20" SF-TOGGLE "Make Inner Hollow" FALSE SF-TOGGLE "Symbol Separate" TRUE SF-VALUE "Symbol Thickness" "5" SF-TOGGLE "Bump Border" TRUE SF-VALUE "Bump Granularity" "3" SF-VALUE "Bump Smoothness" "13" SF-VALUE "Bump Seed" "0" )