To get it to work, I rewrote a little bit of your script. You had this:

>               (gimp-image-scale pic-1 new-pic-width new-pic-height)
>               (if (> (car (gimp-image-get-layers pic-1)) 1)
>                       (gimp-image-merge-visible-layers pic-1 1)
>               )
>               (gimp-image-add-layer sheet layer-1 0)
>               (gimp-rect-select pic-1 0 0 new-pic-width new-pic-height 0 FALSE 0)
>               (gimp-edit-copy (car (gimp-image-get-selection pic-1)))
>               (gimp-edit-paste layer-1 0)
>               (gimp-display-new sheet)

I've replaced this section with:

           (gimp-image-scale pic-1 new-pic-width new-pic-height)
           (set! merged-layer (gimp-image-merge-visible-layers pic-1 1))
           (gimp-rect-select pic-1 0 0 new-pic-width new-pic-height 0 FALSE 0)
           (gimp-edit-copy (car merged-layer))
           (gimp-image-add-layer sheet layer-1 0)
           (gimp-edit-clear layer-1)
           (gimp-edit-paste layer-1 0)
           (gimp-display-new sheet)

The changes are:

1. Always merging the layers. This enables us to set a variable (merged-layer) 
to the resulting layer, so we don't have to figure out what it is later.

2. Copying from the layer, rather than the selection. Gimp was expecting a 
drawable; the selection is a drawable, but internally, it's done as a 
channel. In this case, since everything was selected, everything would be 
represented as a white pixel in the channel (white=selected, black=not 
selected, grey=feathering/anti-aliasing). So, when you copied the selection 
channel, you just copied those white pixels. If you copy from the layer 
instead, it will get the actual contents of the selection.

3. Clearing layer-1 before putting anything on it. Otherwise, it will be 
filled with garbage by default. 

I also moved a couple of lines around a little bit, but it's not necessary. I 
just did it so that I could see similar things next to each other. I know, I 
know.... a foolish consistency is the hobgoblin of little minds. ;-)

> I'm very curious. Greetings from Volker

Glad to help!


Gimp-user mailing list

Reply via email to