RSS/Atom feed Twitter
Site is read-only, email is disabled

script-fu: copy + paste

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

2 of 2 messages available
Toggle history

Please log in to manage your subscriptions.

script-fu: copy + paste Daniel Barna 09 Sep 23:00
script-fu: copy + paste saulgoode 10 Sep 01:42
Daniel Barna
2006-09-09 23:00:43 UTC (over 17 years ago)

script-fu: copy + paste

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)
)

saulgoode
2006-09-10 01:42:54 UTC (over 17 years ago)

script-fu: copy + paste

The thing that I notice in your script is that the new layer you create has its transparency set to "0". Other than that, the paste is being performed, it is just not visible in the output.

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