Hi Guys

 I have just started playing with script-fu as I need to run a batch on some icons for my X-server. I am using Spencer Kimballs alien-glow-logo.scm as my template and have hacked as much out of it as I can using the instructions here http://www.gimp.org/tutorials/Basic_Batch/ and here http://adrian.gimp.org/batch/batch-4.html as a guide. The script itself works (it would seem) but I cant get it to merge and save without user interaction. can anyone suggest where I am going wrong?

Thanks in advance
=^_^=

*********************************************
;  ghost-GLOW-cursor
;  modified alien-glow-logo.scm Simulates an eerie glow around a cursor

(define (apply-ghost-glow-cursor-effect img
                                      logo-layer
                                      size
                                      glow-color)
  (let* ((border (/ size 4))
         (grow (/ size 30))
         (feather (/ size 4))
         (width (car (gimp-drawable-width logo-layer)))
         (height (car (gimp-drawable-height logo-layer)))
         (glow-layer (car (gimp-layer-new img
                                          width height RGBA-IMAGE
                                          "ghost Glow" 100 NORMAL-MODE))))

    (gimp-context-push)

    (gimp-selection-none img)
    (script-fu-util-image-resize-from-layer img logo-layer)
    (gimp-image-add-layer img glow-layer 1)
    (gimp-layer-set-preserve-trans logo-layer TRUE)
    (gimp-edit-clear glow-layer)
    (gimp-selection-layer-alpha logo-layer)
    (gimp-selection-grow img grow)
    (gimp-selection-feather img feather)
    (gimp-context-set-foreground glow-color)
    (gimp-edit-fill glow-layer FOREGROUND-FILL)
    (gimp-selection-none img)

    (gimp-context-set-foreground '(79 79 79))

    (gimp-edit-blend logo-layer FG-BG-RGB-MODE NORMAL-MODE
                     GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
                     FALSE 0 0 TRUE
                     0 0 1 1)

    (gimp-context-pop)))

(define (script-fu-ghost-glow-cursor-alpha img
                                         logo-layer
                                         size
                                         glow-color)
  (begin
    (gimp-image-undo-group-start img)
    (apply-ghost-glow-cursor-effect img logo-layer size glow-color)
    (gimp-image-undo-group-end img)))

(script-fu-register "script-fu-ghost-glow-cursor-alpha"
                    _"ghost _Glow..."
                    "Create a cursor with a green glow"
                    "Spencer Kimball"
                    "Spencer Kimball"
                    "1997"
                    "RGBA"
                    SF-IMAGE      "Image"                   0
                    SF-DRAWABLE   "Drawable"                0
                    SF-ADJUSTMENT _"Glow size (pixels * 4)" '(50 2 1000 1 10 0 1)
                    SF-COLOR      _"Glow color"             '(00 80 00))

(script-fu-menu-register "script-fu-ghost-glow-cursor-alpha"
                         _"<Image>/Script-Fu/Alpha to Logo")


; These 3 lines below are where I'm having trouble, I need to merge the two resulting layers and save.
        (set! layer-to-save (gimp-image-flatten))
        (set! drawable (car (gimp-image-get-active-layer image))
        (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)))

(script-fu-register "script-fu-ghost-glow-cursor"
                    _"ghost _Glow..."
                    "Create a cursor with green glow"
                    "Spencer Kimball"
                    "Spencer Kimball"
                    "1997"
                    ""
                    SF-STRING     _"Text"               "GHOST"
                    SF-ADJUSTMENT _"Font size (pixels)" '(50 2 1000 1 10 0 1)
                    SF-FONT       _"Font"               "Sans Bold"
                    SF-COLOR      _"Glow color"         '(00 80 00))

(script-fu-menu-register "script-fu-ghost-glow-cursor"
                         _"<Toolbox>/Xtns/Script-Fu/Logos")
********************************************************
_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Reply via email to