08-07-2017, 07:00 PM
gimp-edit-named-paste creates a floating selection that needs to be anchored:
Code:
(define (script-fu-two-faces img drw)
(let* (
(drawable-width (car (gimp-drawable-width drw)))
(halfdrawable-width (* drawable-width 0.5))
(drawable-height (car (gimp-drawable-height drw)))
(leftimage (car (gimp-image-new drawable-width drawable-height RGB)))
(leftlayer (car (gimp-layer-new leftimage drawable-width drawable-height 0 "tfl" 100 0)))
(rightimage (car (gimp-image-new drawable-width drawable-height RGB)))
(rightlayer (car (gimp-layer-new rightimage drawable-width drawable-height 0 "tfr" 100 0)))
(floatingLayer 0)
)
(gimp-image-insert-layer leftimage leftlayer 0 0)
(gimp-drawable-fill leftlayer WHITE-FILL)
(gimp-display-new leftimage)
(gimp-image-insert-layer rightimage rightlayer 0 0)
(gimp-drawable-fill rightlayer WHITE-FILL)
(gimp-display-new rightimage)
(gimp-edit-named-copy drw "tobepastedleft")
(set! floatingLayer (car (gimp-edit-named-paste leftlayer "tobepastedleft" TRUE)))
(gimp-floating-sel-anchor floatingLayer)
(gimp-displays-flush)
(gimp-item-transform-flip drw halfdrawable-width 0 halfdrawable-width drawable-height)
(gimp-edit-named-copy drw "tobepastedright")
(set! floatingLayer (car (gimp-edit-named-paste rightlayer "tobepastedright" TRUE)))
(gimp-floating-sel-anchor floatingLayer)
(gimp-displays-flush)
)
)
(script-fu-register "script-fu-two-faces"
"Two faces..."
"Creates an image from left side of the face"
"K.Imai"
"K.Imai"
"2017"
""
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable to apply" 0
)
(script-fu-menu-register "script-fu-two-faces" "<Image>")