Gimp.Layer.new_from_drawable

function new_from_drawable(drawable: Gimp.Drawable, dest_image: Gimp.Image): Gimp.Layer {
    // Gjs wrapper for gimp_layer_new_from_drawable()
}
  

Create a new layer by copying an existing drawable.

This procedure creates a new layer as a copy of the specified drawable. The new layer still needs to be added to the image, as this is not automatic. Add the new layer with the Gimp.Image.prototype.insert_layer command. Other attributes such as layer mask modes, and offsets should be set with explicit procedure calls.

drawable

The source drawable from where the new layer is copied.

dest_image

The destination image to which to add the layer.

Returns

The newly copied layer.