GIMP Version: 2.8.14
Operating System: Windows
GIMP Experience: Basic Level
Hi,
I hope this help request is not wrong as the last I posted.
I was trying to use in a script the PDB function
gimp-selection-border, which I previously tested successfully interactively, but it seemed to me not be working.
Hence I created a specific small script which only tests the border selection, using two different methods:
1-gimp-selection-all, then gimp-selection-border
2-gimp-selection-all, then gimp-selection-shrink, then gimp-selection-invert
The second method works as expected (IMO), while the first not.
In fact the subsequent gimp-edit-fill in case 1 fills the entire layer, in case 2 the created selection
Because I don't know whether I did something wrong in the use or this effect happens only on my system, I attach here the full (small) script, just in case someone wants to give it a try.
(define (script-fu-test-select
theOldImage
theOldLayer
theMethod
; doFlatten
)
; Initialize an undo, so the process can be undone with a single undo
(gimp-image-undo-group-start theOldImage)
; Variable init
(let*
(
(imageWidth (car (gimp-image-width theOldImage)))
(imageHeight (car (gimp-image-height theOldImage)))
(theDuplicatedLayer)
)
(gimp-message-set-handler 2)
(set! theDuplicatedLayer (car (gimp-layer-new-from-drawable theOldLayer theOldImage)))
(gimp-image-add-layer theOldImage theDuplicatedLayer 0)
(gimp-image-set-active-layer theOldImage theDuplicatedLayer)
(case theMethod
((0)
(gimp-selection-all theOldImage)
(gimp-selection-border theOldImage 20)
(gimp-edit-fill theDuplicatedLayer FOREGROUND-FILL)
)
((1)
(gimp-selection-all theOldImage)
(gimp-selection-shrink theOldImage 20)
(gimp-selection-invert theOldImage)
(gimp-edit-fill theDuplicatedLayer BACKGROUND-FILL)
)
)
;Ensure the updated image is displayed now
(gimp-displays-flush)
(gimp-image-undo-group-end theOldImage)
) ; end let*
) ; end define
(script-fu-register
"script-fu-test-select"
"test selection methods"
"test selection methods"
"me"
"Copyright"
"gg/mm/aaaa"
"RGB*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-OPTION "Selection method" '("Border" "Shrink" )
; SF-TOGGLE "Flatten Image"
)
(script-fu-menu-register
"script-fu-test-select"
"<Image>/DNscripts/Test/"
)
Any suggestion?