; Lava Logo V1.3 (11-2007) (c) Copyright
; Create lava text with drop shadow
;
; Interesting text effects can be achieved by varying font, text-color, shadow-color, gradient and lava roughness
;
; Unchecking the animation option produces a static image with one text layer with shadow (semi-flattened)
; Checking the animation option produces 4 layers, drop shadowed and semi-flattened for use as an animated gif (just save as gif)
;
; Checking raw layers options dispays raw layers only
;
; 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, see .
;
; Created by Scott Mosteller - 10-2007
; Comments and questions directed to http://www.gimpchat.com
;
; Compatible with all Gimp Versions 2.x - Enjoy!
;
; ------------
;| Change Log |
; ------------
; V1.0 - Initial Release
; V1.1 - Corrected Bug With Alpha-to-logo
; Added Shadow Offset Sialog
; V1.2 - Correct Bug With Text Color
; Added Animation and Raw layers options
; Revamp Code Structure
; V1.3 - Relocate menu options and update defaults
;
;
; User Options Popup
;
;ここはTosi様のscript-fuを使用しました。
;http://www.geocities.jp/gimproject/scripts/layers-view-delete.html
(define (script-fu-layers-view-none image drawable)
(let* ((layers (gimp-image-get-layers image))
(number-layers (car layers))
(layer-array (cadr layers))
(layer-count 0)
(layer))
(set! layer-count 0)
(while (< layer-count number-layers)
(set! layer (aref layer-array layer-count))
(gimp-layer-set-visible layer FALSE)
(set! layer-count (+ layer-count 1)))
))
(define (script-fu-layers-view-current-only image drawable)
(script-fu-layers-view-none image drawable)
(if (not (= 0 (car (gimp-drawable-is-layer drawable))))
(gimp-layer-set-visible drawable TRUE))
)
(define (script-fu-layers-delete-hidden image drawable)
(let* ((layers (gimp-image-get-layers image))
(number-layers (car layers))
(layer-array (cadr layers))
(layer-count 0)
(layer))
(gimp-image-undo-group-start image)
(set! layer-count 0)
(while (< layer-count number-layers)
(set! layer (aref layer-array layer-count))
(if (= (car (gimp-layer-get-visible layer)) FALSE)
(gimp-image-remove-layer image layer))
(set! layer-count (+ layer-count 1)))
(gimp-image-undo-group-end image)
(gimp-displays-flush)))
(script-fu-register "script-fu-animlava-logo"
"/Xtns/Script-Fu/Logos2/Animation Lava Logo..."
"Creates an animated lava logo with a drop shadow"
"Scott Mosteller"
"Scott Mosteller"
"2007"
""
SF-STRING _"Text" "Gimp"
SF-ADJUSTMENT _"Font size (pixels)" '(150 2 1000 1 10 0 1)
SF-FONT _"Font" "Serif Bold"
SF-COLOR _"Background color" '(255 255 255)
SF-COLOR _"Text color" '(147 233 255)
SF-COLOR _"Shadow color" '(0 0 0)
SF-ADJUSTMENT _"Shadow Offset X" '(4 0 100 1 1 0 1)
SF-ADJUSTMENT _"Shadow Offset Y" '(4 0 100 1 1 0 1)
SF-ADJUSTMENT _"Shadow blur" '(5 0 100 1 1 0 1)
SF-ADJUSTMENT _"Shadow Opacity" '(60 1 100 1 1 0 1)
SF-GRADIENT _"Lava Gradient" "German flag smooth"
SF-TOGGLE _"Use Active Gradient?" FALSE
SF-ADJUSTMENT _"Lava Roughness" '(9 2 20 1 1 0 1)
SF-TOGGLE _"Animate?" TRUE
SF-TOGGLE _"Raw Layers Only?(not semi-flatten)" FALSE
SF-TOGGLE _"Background Transparent?" FALSE
)
;
;
; Define Main Lava-Logo Function
;
(define (script-fu-animlava-logo text
size
font
bg-color
text-color
shadow-color
shx
shy
sblur
sho
lgrad
active
lruff
lani
raw
trans?
)
(let* ((img (car (gimp-image-new 256 256 RGB)))
(tmpfg (car (gimp-palette-get-foreground img)))
(tmpbg (car (gimp-palette-get-background img)))
(tmp (car (gimp-palette-set-foreground text-color)))
(text-layer (car (gimp-text-fontname img -1 0 0 text (+ (/ size 12) 4) TRUE size PIXELS font)))
; (text-layer2 (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font)))
; (text-layer3 (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font)))
; (text-layer4 (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font)))
)
;
; Lava Text Main Procedure Body
;
; Create animation layer 1
;
(gimp-image-undo-disable img)
(gimp-drawable-set-name text-layer text)
(script-fu-animlava-logocore img
text-layer
bg-color
text-color
shadow-color
shx
shy
sblur
sho
lgrad
active
lruff
lani
raw
trans?
)
(gimp-palette-set-foreground tmpfg)
(gimp-palette-set-background tmpbg)
(gimp-image-undo-enable img)
(gimp-display-new img)))
;
; End Lava Text Main Procedure
;
;
; Define Lava Logo Apply Routine
;
;
(define (apply-animlava-logo-effect img
logo-layer
bg-color
text-color
shadow-color
shx
shy
sblur
sho
lgrad
active
lruff
lani
raw
trans?
tmpfg
tmpbg)
(let* ((width (car (gimp-drawable-width logo-layer)))
(height (car (gimp-drawable-height logo-layer)))
(shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" sho NORMAL-MODE))))
;
; Subroutine - Lava Logo Apply Body
;
(gimp-selection-none img)
(script-fu-util-image-resize-from-layer img logo-layer)
;
; Set color for active gradient & call Lava effects procedure
;
(gimp-palette-set-foreground tmpfg)
(gimp-palette-set-background tmpbg)
(script-fu-lava img logo-layer 10 10 lruff lgrad 1 1 active)
; (let* ((layers (gimp-image-get-layers img))
; (number-layers (car layers))
; (layer-array (cadr layers))
; (layer))
; (set! layer (aref layer-array 0))
; (plug-in-erode 1 img layer 0 0 0 0 0 0) ;add 2.2
; )
;
; Create shadow layer
;
(gimp-selection-none img)
(gimp-image-add-layer img shadow-layer 10) ;changed
(gimp-layer-resize-to-image-size shadow-layer)
(gimp-edit-clear shadow-layer)
(gimp-selection-layer-alpha logo-layer)
(if (>= sblur 1) (gimp-selection-feather img sblur))
(gimp-palette-set-background shadow-color)
(gimp-edit-fill shadow-layer BACKGROUND-FILL)
(gimp-layer-translate shadow-layer shx shy)
; (gimp-image-lower-layer img shadow-layer) ; Drop shadow to bottom ;none
; (gimp-image-lower-layer img shadow-layer) ;none
; (gimp-image-lower-layer img shadow-layer) ;none
; (gimp-image-lower-layer img shadow-layer) ;none
;;; (gimp-image-resize-to-layers img)
))
;
; End Subroutine Apply
;
(define (script-fu-animlava-logoimg img
drawable
bg-color
text-color
shadow-color
shx
shy
sblur
sho
lgrad
active
lruff
lani
raw
trans?
)
(let* (
(tmpfg (car (gimp-palette-get-foreground img)))
(tmpbg (car (gimp-palette-get-background img)))
(tmp (car (gimp-palette-set-foreground text-color)))
)
(script-fu-animlava-logocore img
drawable
bg-color
text-color
shadow-color
shx
shy
sblur
sho
lgrad
active
lruff
lani
raw
trans?
)
;(gimp-image-undo-group-end img)
)
)
;画像加工本体
(define (script-fu-animlava-logoimgh img
drawable
bg-color
text-color
shadow-color
shx
shy
sblur
sho
lgrad
active
lruff
lani
raw
trans?
)
(let* (
(img2 (car (gimp-channel-ops-duplicate img)))
(drawable2 (car (gimp-image-get-active-layer img2)))
)
(gimp-image-undo-disable img2)
(script-fu-layers-view-current-only img2 drawable2) ;Tosi様のscript-fuより
(script-fu-layers-delete-hidden img2 drawable2) ;Tosi様のscript-fuより
(script-fu-animlava-logoimg img2
drawable2
bg-color
text-color
shadow-color
shx
shy
sblur
sho
lgrad
active
lruff
lani
raw
trans?
)
(gimp-image-undo-enable img2)
(gimp-display-new img2)
)
)
(script-fu-register "script-fu-animlava-logoimgh"
"/Script-Fu/Animators/Animation Lava..."
"Creates an animated lava logo with a drop shadow"
"Scott Mosteller"
"Scott Mosteller"
"2007"
"RGBA"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-COLOR _"Background color" '(255 255 255)
SF-COLOR _"Text color" '(147 233 255)
SF-COLOR _"Shadow color" '(0 0 0)
SF-ADJUSTMENT _"Shadow Offset X" '(4 0 100 1 1 0 1)
SF-ADJUSTMENT _"Shadow Offset Y" '(4 0 100 1 1 0 1)
SF-ADJUSTMENT _"Shadow blur" '(5 0 100 1 1 0 1)
SF-ADJUSTMENT _"Shadow Opacity" '(60 1 100 1 1 0 1)
SF-GRADIENT _"Lava Gradient" "German flag smooth"
SF-TOGGLE _"Use Active Gradient?" FALSE
SF-ADJUSTMENT _"Lava Roughness" '(9 2 20 1 1 0 1)
SF-TOGGLE _"Animate?" TRUE
SF-TOGGLE _"Raw Layers Only?(not semi-flatten)" FALSE
SF-TOGGLE _"Background Transparent?" FALSE
)
(define (script-fu-animlava-logocore img
text-layer
bg-color
text-color
shadow-color
shx
shy
sblur
sho
lgrad
active
lruff
lani
raw
trans?
)
(let* (
(lay1 0)
(lay2 0)
(lay3 0)
(lay4 0)
(tmpfg (car (gimp-palette-get-foreground img)))
(tmpbg (car (gimp-palette-get-background img)))
(width (car (gimp-drawable-width text-layer)))
(height (car (gimp-drawable-height text-layer)))
(text-layer2 (car (gimp-layer-copy text-layer TRUE)))
(text-layer3 (car (gimp-layer-copy text-layer TRUE)))
(text-layer4 (car (gimp-layer-copy text-layer TRUE)))
(bg-layer (car (gimp-layer-new img (+ (+ width shx) (* sblur 1.1)) (+ (+ height shy) (* sblur 1.1)) RGB-IMAGE "Background" 100 NORMAL)))
(bg-layer2 (car (gimp-layer-new img (+ (+ width shx) (* sblur 1.1)) (+ (+ height shy) (* sblur 1.1)) RGB-IMAGE "Background" 100 NORMAL)))
(bg-layer3 (car (gimp-layer-new img (+ (+ width shx) (* sblur 1.1)) (+ (+ height shy) (* sblur 1.1)) RGB-IMAGE "Background" 100 NORMAL)))
(bg-layer4 (car (gimp-layer-new img (+ (+ width shx) (* sblur 1.1)) (+ (+ height shy) (* sblur 1.1)) RGB-IMAGE "Background" 100 NORMAL)))
(dummy1 (car (gimp-layer-new img width height RGBA-IMAGE "dummy" 100 NORMAL)))
(dummy2 (car (gimp-layer-new img width height RGBA-IMAGE "dummy" 100 NORMAL)))
(dummy3 (car (gimp-layer-new img width height RGBA-IMAGE "dummy" 100 NORMAL)))
(dummy4 (car (gimp-layer-new img width height RGBA-IMAGE "dummy" 100 NORMAL)))
(shou 0)
)
(gimp-image-add-layer img text-layer2 0) ;add
(gimp-image-add-layer img text-layer3 0) ;add
(gimp-image-add-layer img text-layer4 0) ;add
; Turn off text layers 2,3,4
;
(gimp-drawable-set-visible text-layer2 0)
(gimp-drawable-set-visible text-layer3 0)
(gimp-drawable-set-visible text-layer4 0)
(gimp-image-resize img (+ (+ width shx) (* sblur 1.1)) (+ (+ height shy) (* sblur 1.1)) (/ (* sblur 1.1) 2) (/ (* sblur 1.1) 2))
(gimp-layer-resize text-layer (+ (+ width shx) (* sblur 1.1)) (+ (+ height shy) (* sblur 1.1)) (/ (* sblur 1.1) 2) (/ (* sblur 1.1) 2))
(apply-animlava-logo-effect img text-layer bg-color text-color shadow-color shx shy sblur sho lgrad active lruff lani trans? raw tmpfg tmpbg)
(if (= FALSE trans?)
(begin
(gimp-image-add-layer img bg-layer 6) ;add
(gimp-selection-none img) ;add
(gimp-palette-set-background bg-color) ;add
(gimp-edit-fill bg-layer BACKGROUND-FILL) ;add
(set! lay1 (car (gimp-image-merge-visible-layers img 0))) ;add
(if (= raw TRUE) (gimp-drawable-set-visible lay1 0)) ;add
))
(if (= raw FALSE)
(begin
(gimp-image-add-layer img dummy1 0) ;add
(gimp-drawable-fill dummy1 TRANS-IMAGE-FILL) ;add noise remove
(set! lay1 (car (gimp-image-merge-visible-layers img 0)))
(gimp-drawable-set-name lay1 "frame1")
(gimp-selection-none img)
(gimp-palette-set-background bg-color)
(gimp-image-set-active-layer img lay1)
(plug-in-semiflatten 1 img lay1)
(gimp-drawable-set-visible lay1 0)
))
(if (and (= TRUE trans?) (= raw TRUE))
(begin
(set! lay1 (car (gimp-image-merge-visible-layers img 0)))
(gimp-drawable-set-visible lay1 0)
))
;
; Skip if not animated
;
(if (= lani TRUE)
(begin
;
; Create animation layer 2
;
(gimp-drawable-set-visible text-layer2 1)
(gimp-layer-resize text-layer2 (+ (+ width shx) (* sblur 1.1)) (+ (+ height shy) (* sblur 1.1)) (/ (* sblur 1.1) 2) (/ (* sblur 1.1) 2))
(apply-animlava-logo-effect img text-layer2 bg-color text-color shadow-color shx shy sblur sho lgrad active lruff lani trans? raw tmpfg tmpbg)
(if (= FALSE trans?)
(begin
(gimp-image-add-layer img bg-layer2 6) ;add
(gimp-selection-none img) ;add
(gimp-palette-set-background bg-color) ;add
(gimp-edit-fill bg-layer2 BACKGROUND-FILL) ;add
(set! lay2 (car (gimp-image-merge-visible-layers img 0))) ;add
(if (= raw TRUE) (gimp-drawable-set-visible lay2 0)) ;add
))
(if (= raw FALSE)
(begin
(gimp-image-add-layer img dummy2 0) ;add
(gimp-drawable-fill dummy2 TRANS-IMAGE-FILL) ;add noise remove
(set! lay2 (car (gimp-image-merge-visible-layers img 0)))
(gimp-drawable-set-name lay2 "frame2")
(gimp-selection-none img)
(gimp-palette-set-background bg-color)
(gimp-image-set-active-layer img lay2)
(plug-in-semiflatten 1 img lay2)
(gimp-drawable-set-visible lay2 0)
))
(if (and (= TRUE trans?) (= raw TRUE))
(begin
(set! lay2 (car (gimp-image-merge-visible-layers img 0)))
(gimp-drawable-set-visible lay2 0)
))
;
; Create animation layer 3
;
(gimp-drawable-set-visible text-layer3 1)
(gimp-layer-resize text-layer3 (+ (+ width shx) (* sblur 1.1)) (+ (+ height shy) (* sblur 1.1)) (/ (* sblur 1.1) 2) (/ (* sblur 1.1) 2))
(apply-animlava-logo-effect img text-layer3 bg-color text-color shadow-color shx shy sblur sho lgrad active lruff lani trans? raw tmpfg tmpbg)
(if (= FALSE trans?)
(begin
(gimp-image-add-layer img bg-layer3 6) ;add
(gimp-selection-none img) ;add
(gimp-palette-set-background bg-color) ;add
(gimp-edit-fill bg-layer3 BACKGROUND-FILL) ;add
(set! lay3 (car (gimp-image-merge-visible-layers img 0))) ;add
(if (= raw TRUE) (gimp-drawable-set-visible lay3 0)) ;add
))
(if (= raw FALSE)
(begin
(gimp-image-add-layer img dummy3 0) ;add
(gimp-drawable-fill dummy3 TRANS-IMAGE-FILL) ;add noise remove
(set! lay3 (car (gimp-image-merge-visible-layers img 0)))
(gimp-drawable-set-name lay3 "frame3")
(gimp-selection-none img)
(gimp-palette-set-background bg-color)
(gimp-image-set-active-layer img lay3)
(plug-in-semiflatten 1 img lay3)
(gimp-drawable-set-visible lay3 0)
))
(if (and (= TRUE trans?) (= raw TRUE))
(begin
(set! lay3 (car (gimp-image-merge-visible-layers img 0)))
(gimp-drawable-set-visible lay3 0)
))
;
; Create animation layer 4
;
(gimp-drawable-set-visible text-layer4 1)
(gimp-layer-resize text-layer4 (+ (+ width shx) (* sblur 1.1)) (+ (+ height shy) (* sblur 1.1)) (/ (* sblur 1.1) 2) (/ (* sblur 1.1) 2))
(apply-animlava-logo-effect img text-layer4 bg-color text-color shadow-color shx shy sblur sho lgrad active lruff lani trans? raw tmpfg tmpbg)
(if (= FALSE trans?)
(begin
(gimp-image-add-layer img bg-layer4 6) ;add
(gimp-selection-none img) ;add
(gimp-palette-set-background bg-color) ;add
(gimp-edit-fill bg-layer4 BACKGROUND-FILL) ;add
(set! lay4 (car (gimp-image-merge-visible-layers img 0))) ;add
(if (= raw TRUE) (gimp-drawable-set-visible lay4 0)) ;add
))
(if (= raw FALSE)
(begin
(gimp-image-add-layer img dummy4 0) ;add
(gimp-drawable-fill dummy4 TRANS-IMAGE-FILL) ;add noise remove
(set! lay4 (car (gimp-image-merge-visible-layers img 0)))
(gimp-drawable-set-name lay4 "frame4")
(gimp-selection-none img)
(gimp-palette-set-background bg-color)
(gimp-image-set-active-layer img lay4)
(plug-in-semiflatten 1 img lay4)
(gimp-drawable-set-visible lay4 0)
))
(if (and (= TRUE trans?) (= raw TRUE))
(begin
(set! lay4 (car (gimp-image-merge-visible-layers img 0)))
(gimp-drawable-set-visible lay4 0)
))
))
;
; Raw and animation cleanup
;
;;(if (= raw FALSE) ;none
;; (begin ;none
(gimp-drawable-set-visible lay1 1)
; (plug-in-autocrop 1 img lay1) ;none
(if (= lani TRUE)
(begin
(gimp-drawable-set-visible lay2 1)
(gimp-drawable-set-visible lay3 1)
(gimp-drawable-set-visible lay4 1)
))
;; )) ;none
(if (= lani FALSE)
(begin
(gimp-image-remove-layer img text-layer2)
(gimp-image-remove-layer img text-layer3)
(gimp-image-remove-layer img text-layer4)
))
(set! width (car (gimp-image-width img))) ;add
(set! height (car (gimp-image-height img))) ;add
(if (and (>= shx shy) (>= sblur shy)) ;add
(set! shou shy) ;add
) ;add
(if (and (>= shy shx) (>= sblur shx)) ;add
(set! shou shx) ;add
) ;add
(if (and (>= shy sblur) (>= shx sblur)) ;add
(set! shou sblur) ;add
) ;add
(gimp-image-resize img (- width (/ shou 2)) (- height (/ shou 2)) (- 0 (/ shou 2)) (- 0 (/ shou 2)))
(gimp-layer-resize lay1 (- width (/ shou 2)) (- height (/ shou 2)) (- 0 (/ shou 2)) (- 0 (/ shou 2)))
(if (= lani TRUE)
(begin
(gimp-layer-resize lay2 (- width (/ shou 2)) (- height (/ shou 2)) (- 0 (/ shou 2)) (- 0 (/ shou 2)))
(gimp-layer-resize lay3 (- width (/ shou 2)) (- height (/ shou 2)) (- 0 (/ shou 2)) (- 0 (/ shou 2)))
(gimp-layer-resize lay4 (- width (/ shou 2)) (- height (/ shou 2)) (- 0 (/ shou 2)) (- 0 (/ shou 2)))
))
(gimp-selection-none img)
)
)