Quoting Pablo Yaggi <pya...@alsurdelsur.com>:
> Ok, I made it work, I just replaced newlayer for newimage in the
> gimp-edit-paste call and it worked.
> But pasting into the image should work, shouldn't ?, do I have
> to set up a current layer or something ?
There is no "paste-as-new-layer" function provided as such by the PDB
interface (though there is a menu command for that) and so you must
perform a couple of separate functions to achieve the same result.
You do not need to set up a current layer, but you need to perform a
'gimp-floating-sel-to-layer' after your 'gimp-edit-paste'. This will
result in a new layer at the top of the layerstack -- unlike the menu
command, which places the new layer above the active layer -- and
therefore it does not matter which layer (or drawable) is active at
the time the paste is performed.
If you instead wish the resulting new layer to appear just above the
current layer then you will need to make note of the current layer's
position (using 'gimp-image-get-layer-position') and lower the pasted
layer accordingly (using 'gimp-image-lower-layer' the appropriate
number of times).
Gimp-developer mailing list