Gimp.Image.prototype.insert_layer

function insert_layer(layer: Gimp.Layer, parent: Gimp.Layer, position: Number(gint)): Boolean {
    // Gjs wrapper for gimp_image_insert_layer()
}
  

Add the specified layer to the image.

This procedure adds the specified layer to the image at the given position. If the specified parent is a valid layer group (See Gimp.Item.prototype.is_group and gimp_layer_group_new()) then the layer is added inside the group. If the parent is 0, the layer is added inside the main stack, outside of any group. The position argument specifies the location of the layer inside the stack (or the group, if a valid parent was supplied), starting from the top (0) and increasing. If the position is specified as -1 and the parent is specified as 0, then the layer is inserted above the active layer, or inside the group if the active layer is a layer group. The layer type must be compatible with the image base type.

layer

The layer.

parent

The parent layer.

position

The layer position.

Returns

TRUE on success.