Hi,
I tried to set up my first script. I wanted to modify the old-photo script 
in such a way to make the border fade out into transparency instead of a 
color. I failed. Below is the simplified script, which should only make a 
transparent border, but it does not work. My idea was to
1 - make a feathered selection in the original image, copy this selection
2 - create a new transparent layer
3 - paste the previous selection into it
4 - finally remove (or make invisible) the bottom layer
If I use the script below (where the creation of the transparent layer and 
the following steps are commented out), and then I create the new 
transparent layer manyally in the gui of gimp, then Ctrl+V indeed works 
well: it makes a paste of the feathered selection.
However, if I uncomment even only the first 2 commented lines (which 
create a new transparent layer and adds it to the image), then Ctrl+V 
does not paste anything anymore; just a blank selection. Pasting from the 
script (following lines in the script) also do not paste anything.
Could anybody please explain me why, and how to overcome this?
Thank you
Daniel


(define (script-fu-transparent-border inImage inLayer inBorderSize 
inFeatherSize inCopy)
  (gimp-image-undo-group-start inImage)
  (gimp-selection-all inImage)
  (set! theImage (if (= inCopy TRUE)
                     (car (gimp-image-duplicate inImage))
                     inImage)
        )
  
  (set! theLayer (car (gimp-image-flatten theImage)))
  (set! theWidth (car (gimp-image-width theImage)))
  (set! theHeight (car (gimp-image-height theImage)))

  (gimp-selection-none theImage)
  (gimp-selection-all theImage)
  (gimp-selection-shrink theImage inBorderSize)
  (gimp-selection-feather theImage inFeatherSize)
  (gimp-edit-copy theLayer)
;  (set! transparentLayer (car (gimp-layer-new theImage theWidth theHeight 
RGBA-IMAGE "Transparent" 0 NORMAL-MODE)))
;  (gimp-image-add-layer theImage transparentLayer -1)

;  (gimp-image-set-active-layer theImage transparentLayer)
;  (let ((floating-sel (car (gimp-edit-paste transparentLayer FALSE))))
;       (gimp-floating-sel-anchor floating-sel))

;  (gimp-drawable-set-visible theLayer 0)
  
;  (if     (= inCopy TRUE)
;         (begin  (gimp-image-clean-all theImage)
;                 (gimp-display-new theImage)
;                 )
;         ()
;         )

  (gimp-selection-none theImage)
  (gimp-image-undo-group-end inImage)
  (gimp-displays-flush theImage)
  )

_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Reply via email to