It is currently Fri Jul 05, 2024 12:35 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to merge down layer copy
PostPosted: Thu Apr 23, 2020 11:49 pm  (#1) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Hi everyone. I'm trying to create a heart shape and I been successfully up to almost the last part of the script. Now I need to merge down the duplicated copy but I'm getting a fail error " Failed: There is no visible layer to merge down to." What I need to change in the code? Thank you in advanced!

(define (script-fu-create-heart)
    (let* (
        (img  (car (gimp-image-new 500 500 RGB)))
        (layer (car (gimp-layer-new img 500 500 RGB-IMAGE "Background" 100 LAYER-MODE-NORMAL)))
      (theheart (car (gimp-layer-new img 500 500 RGB "Heart" 100 LAYER-MODE-NORMAL)))
      (layer-mask 0)
      
      )


      ;Create the Background
        (gimp-image-undo-disable img)              ; Disable undo during the image creation
        (gimp-image-insert-layer img layer 0 0)
      (gimp-context-set-foreground '(000 000 00))
      (gimp-drawable-fill layer FILL-FOREGROUND)
      
      ;Create the heart layer
      (gimp-image-add-layer img theheart -1)
      (gimp-layer-add-alpha theheart)
      (gimp-drawable-fill theheart FILL-TRANSPARENT)
      
      ;Create the the first half of the heart
      (gimp-image-select-ellipse img  2 60 105 385 285)
      (gimp-image-select-rectangle img  1  30  50  440  200)
      (gimp-image-select-ellipse img  0 58 143 385  215)
      (gimp-context-set-foreground '(221 0 0))
      (gimp-drawable-edit-fill theheart FILL-FOREGROUND)
      (gimp-selection-none img)
      (gimp-item-transform-rotate theheart  45.00  TRUE   250.50  268.00)
      (gimp-layer-resize-to-image-size theheart)
      (gimp-image-select-rectangle img  2  0  0  250  500)
      
      (set! layer-mask (car (gimp-layer-create-mask theheart ADD-MASK-SELECTION)))
      (gimp-layer-add-mask theheart layer-mask)
      (gimp-layer-remove-mask theheart 0)
      (gimp-selection-none img)
      
      ;Create the second half of the heart
      (gimp-image-duplicate img)
      (gimp-image-flip img ORIENTATION-HORIZONTAL)
      
      (gimp-image-merge-down img layer 1)
      
      
            
      (gimp-image-undo-enable img)
      
      
      
      
      (gimp-display-new img)
      

_________________
https://www.deviantart.com/pocholo17
Image


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: How to merge down layer copy
PostPosted: Fri Apr 24, 2020 1:50 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Apr 05, 2020
Posts: 41
Hello, Pocholo, :)

You have created duplicate image without assignement... useless.

You have to :
- create a copy of theheart --> halfHeart
- flip the layer halfHeart
- merge down halfHeart
- verify everything is useful in your script

Have fun. :)
@+++

_________________


Last edited by JimmyMarco on Fri Apr 24, 2020 4:00 am, edited 1 time in total.

Top
 Post subject: Re: How to merge down layer copy
PostPosted: Fri Apr 24, 2020 2:10 am  (#3) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
After creating a layer, you have to add/insert it in the image (this applies to each of your two layers). This sets its position, and Gimp will know what to do when you merge.

_________________
Image


Top
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Copy Layer Group (SOLVED)

0

No new posts Attachment(s) Path copy rotate shift plus + Path copy rotate shift walk Play

79

No new posts Attachment(s) Automate merge of multiple files horizontally

3

No new posts Attachment(s) Path Copy Rotate Shift Plus

18

No new posts Attachment(s) Adding a image as a layer, moving layer, and then flattening

2



* Login  



Powered by phpBB3 © phpBB Group