Roland Roberts ([EMAIL PROTECTED]) wrote:
> I'm trying to copy a layer from one image to another.  Below is a
> fragment of the code to do this; new-image has already been created
> with the same base type as the old-image.
>     (gimp-selection-all old-image)
>     (gimp-edit-copy old-layer)

It *might* (just tested with the GUI) be a better idea to use
(gimp-selection-none old-image), since  "If there is no selection, then
the specified drawable's contents will be stored in the internal GIMP
edit buffer" and gimp does not try to optimize the amount that gets
stored in the buffer.

>     (gimp-floating-sel-anchor (car (gimp-edit-paste new-layer 1)))
>     (apply gimp-layer-set-offsets (append (list new-layer)
>                                           (gimp-drawable-offsets old-layer)))

Also you might want to use gimp-floating-sel-to-layer and use 
(gimp-layer-set-offsets ..) on this newly created layer. So you can
avoid weird placement effects if the floating selection is smaller or
bigger than the target layer.

However, it is an annoyance that gimp-layer-copy restricts the usage of
the result to the originating image. This is weird, since the GUI can
handle drag'n'drop of layers to other images quite fine.


Gimp-developer mailing list

Reply via email to