See also: Main Index; Alphabetic; Misc; By Author; By Module; By Menu External Links: The Gimp; Gimp User Manual
The Gimp layer functions
gimp_floating_sel_to_layer
Input:
| LAYER | floating_sel | The floating selection |
Returns: nothing
This procedure transforms the specified floating selection into a layer with the same offsets and extents. The composited image will look precisely the same, but the floating selection layer will no longer be clipped to the extents of the drawable it was attached to. The floating selection will become the active layer. This procedure will not work if the floating selection has a different base type from the underlying image. This might be the case if the floating selection is above an auxillary channel or a layer mask.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_image_add_layer
Input:
| IMAGE | image | The image |
| LAYER | layer | The layer |
| INT32 | position | The layer position |
Returns: nothing
This procedure adds the specified layer to the gimage at the given position. If the position is specified as -1, then the layer is inserted at the top of the layer stack. If the layer to be added has no alpha channel, it must be added at position 0. The layer type must be compatible with the image base type.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_image_add_layer_mask
Input:
| IMAGE | image | The image |
| LAYER | layer | The layer to receive the mask |
| CHANNEL | mask | The mask to add to the layer |
Returns: nothing
This procedure adds a layer mask to the specified layer. Layer masks serve as an additional alpha channel for a layer. This procedure will fail if a number of prerequisites aren't met. The layer cannot already have a layer mask. The specified mask must exist and have the same dimensions as the layer. Both the mask and the layer must have been created for use with the specified image.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_image_get_active_layer
Input:
Returns:
| LAYER | active_layer | The active layer |
If there is an active layer, its ID will be returned, otherwise, -1. If a channel is currently active, then no layer will be. If a layer mask is active, then this will return the associated layer.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_image_get_layer_by_tattoo
Input:
| IMAGE | image | The image |
| INT32 | tattoo | The tattoo of the layer to find |
Returns:
| LAYER | layer | The layer with the specified tattoo |
This procedure returns the layer with the given tattoo in the specified image.
Jay Cox; 1998
gimp_image_get_layers
Input:
Returns:
| INT32 | num_layers | The number of layers contained in the image |
| INT32ARRAY | layer_ids | The list of layers contained in the image |
This procedure returns the list of layers contained in the specified image. The order of layers is from topmost to bottommost.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_image_lower_layer
Input:
| IMAGE | image | The image |
| LAYER | layer | The layer to lower |
Returns: nothing
This procedure lowers the specified layer one step in the existing layer stack. It will not move the layer if there is no layer below it, or the layer has no alpha channel.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_image_lower_layer_to_bottom
Input:
| IMAGE | image | The image |
| LAYER | layer | The layer to lower to bottom |
Returns: nothing
This procedure lowers the specified layer to bottom of the existing layer stack. It will not move the layer if there is no layer below it, or the layer has no alpha channel.
Wolfgang Hofer; 1998
gimp_image_merge_visible_layers
Input:
| IMAGE | image | The image |
| INT32 | merge_type | The type of merge: { EXPAND_AS_NECESSARY (0), CLIP_TO_IMAGE (1), CLIP_TO_BOTTOM_LAYER (2) } |
Returns:
| LAYER | layer | The resulting layer |
This procedure combines the visible layers into a single layer using the specified merge type. A merge type of EXPAND_AS_NECESSARY expands the final layer to encompass the areas of the visible layers. A merge type of CLIP_TO_IMAGE clips the final layer to the extents of the image. A merge type of CLIP_TO_BOTTOM_LAYER clips the final layer to the size of the bottommost layer.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_image_pick_correlate_layer
Input:
| IMAGE | image | The image |
| INT32 | x | The x coordinate for the pick |
| INT32 | y | The y coordinate for the pick |
Returns:
| LAYER | layer | The layer found at the specified coordinates |
This procedure finds the layer which is visible at the specified coordinates. Layers which do not qualify are those whose extents do not pass within the specified coordinates, or which are transparent at the specified coordinates. This procedure will return -1 if no layer is found.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_image_raise_layer
Input:
| IMAGE | image | The image |
| LAYER | layer | The layer to raise |
Returns: nothing
This procedure raises the specified layer one step in the existing layer stack. It will not move the layer if there is no layer above it, or the layer has no alpha channel.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_image_raise_layer_to_top
Input:
| IMAGE | image | The image |
| LAYER | layer | The layer to raise to top |
Returns: nothing
This procedure raises the specified layer to top of the existing layer stack. It will not move the layer if there is no layer above it, or the layer has no alpha channel.
Wolfgang Hofer; 1998
gimp_image_remove_layer
Input:
| IMAGE | image | The image |
| LAYER | layer | The layer |
Returns: nothing
This procedure removes the specified layer from the image. If the layer doesn't exist, an error is returned. If there are no layers left in the image, this call will fail. If this layer is the last layer remaining, the image will become empty and have no active layer.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_image_remove_layer_mask
Input:
| IMAGE | image | The image |
| LAYER | layer | The layer from which to remove mask |
| INT32 | mode | Removal mode: { APPLY (0), DISCARD (1) } |
Returns: nothing
This procedure removes the specified layer mask from the layer. If the mask doesn't exist, an error is returned.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_image_set_active_layer
Input:
| IMAGE | image | The image |
| LAYER | active_layer | The new image active layer |
Returns: nothing
If the layer exists, it is set as the active layer in the image. Any previous active layer or channel is set to inactive. An exception is a previously existing floating selection, in which case this procedure will return an execution error.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_add_alpha
Input:
Returns: nothing
This procedure adds an additional component to the specified layer if it does not already possess an alpha channel. An alpha channel makes it possible to move a layer from the bottom of the layer stack and to clear and erase to transparency, instead of the background color. This transforms images of type RGB to RGBA, GRAY to GRAYA, and INDEXED to INDEXEDA.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_copy
Input:
| LAYER | layer | The layer to copy |
| INT32 | add_alpha | Add an alpha channel to the copied layer |
Returns:
| LAYER | layer_copy | The newly copied layer |
This procedure copies the specified layer and returns the copy. The newly copied layer is for use within the original layer's image. It should not be subsequently added to any other image. The copied layer can optionally have an added alpha channel. This is useful if the background layer in an image is being copied and added to the same image.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_create_mask
Input:
| LAYER | layer | The layer to which to add the mask |
| INT32 | mask_type | The type of mask: { WHITE_MASK (0), BLACK_MASK (1), ALPHA_MASK (2) } |
Returns:
| CHANNEL | mask | The newly created mask |
This procedure creates a layer mask for the specified layer. Layer masks serve as an additional alpha channel for a layer. Three different types of masks are allowed initially: completely white masks (which will leave the layer fully visible), completely black masks (which will give the layer complete transparency, and the layer's already existing alpha channel (which will leave the layer fully visible, but which may be more useful than a white mask). The layer mask still needs to be added to the layer. This can be done with a call to 'gimage_add_layer_mask'.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_delete
Input:
| LAYER | layer | The layer to delete |
Returns: nothing
This procedure deletes the specified layer. This must not be done if the gimage containing this layer was already deleted or if the layer was already removed from the image. The only case in which this procedure is useful is if you want to get rid of a layer which has not yet been added to an image.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_get_apply_mask
Input:
Returns:
| INT32 | apply_mask | The layer's apply mask setting |
This procedure returns the specified layer's apply mask setting. If the value is non-zero, then the layer mask for this layer is currently being composited with the layer's alpha channel.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_get_edit_mask
Input:
Returns:
| INT32 | edit_mask | The layer's show mask setting |
This procedure returns the specified layer's show mask setting. If the value is non-zero, then the layer mask for this layer is currently active, and not the layer.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_get_linked
Input:
Returns:
| INT32 | linked | The layer linked state (for moves) |
This procedure returns the specified layer's linked state.
Wolfgang Hofer; 1998
gimp_layer_get_mode
Input:
Returns:
| INT32 | mode | The layer combination mode |
This procedure returns the specified layer's combination mode.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_get_name
Input:
Returns:
This procedure returns the specified layer's name.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_get_opacity
Input:
Returns:
| FLOAT | opacity | The layer opacity |
This procedure returns the specified layer's opacity.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_get_preserve_trans
Input:
Returns:
| INT32 | preserve_trans | The layer's preserve transperancy setting |
This procedure returns the specified layer's preserve transperancy setting.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_get_show_mask
Input:
Returns:
| INT32 | show_mask | The layer's show mask setting |
This procedure returns the specified layer's show mask setting. If the value is non-zero, then the layer mask for this layer is currently being shown instead of the layer.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_get_tattoo
Input:
Returns:
| INT32 | tattoo | The layer tattoo |
This procedure returns the specified layer's tattoo. A tattoo is a unique and permanent identifier attached to a layer that can be used to uniquely identify a layer within an image even between sessions
Jay Cox; 1998
gimp_layer_get_visible
Input:
Returns:
| INT32 | visible | The layer visibility |
This procedure returns the specified layer's visibility.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_is_floating_sel
Input:
Returns:
| INT32 | is_floating_sel | Non-zero if the layer is a floating selection |
This procedure returns whether the layer is a floating selection. Floating selections are special cases of layers which are attached to a specific drawable.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_mask
Input:
Returns:
| CHANNEL | mask | The layer mask |
This procedure returns the specified layer's mask, or -1 if none exists.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_new
Input:
| IMAGE | image | The image to which to add the layer |
| INT32 | width | The layer width: (0 < width) |
| INT32 | height | The layer height: (0 < height) |
| INT32 | type | The layer type: { RGB_IMAGE (0), RGBA_IMAGE (1), GRAY_IMAGE (2), GRAYA_IMAGE (3), INDEXED_IMAGE (4), INDEXEDA_IMAGE (5) } |
| STRING | name | The layer name |
| FLOAT | opacity | The layer opacity: (0 <= opacity <= 100) |
| INT32 | mode | The layer combination mode: { NORMAL_MODE (0), DISSOLVE_MODE (1), BEHIND_MODE (2), MULTIPLY_MODE (3), SCREEN_MODE (4), OVERLAY_MODE (5), DIFFERENCE_MODE (6), ADDITION_MODE (7), SUBTRACT_MODE (8), DARKEN_ONLY_MODE (9), LIGHTEN_ONLY_MODE (10), HUE_MODE (11), SATURATION_MODE (12), COLOR_MODE (13), VALUE_MODE (14), DIVIDE_MODE (15) } |
Returns:
| LAYER | layer | The newly created layer |
This procedure creates a new layer with the specified width, height, and type. Name, opacity, and mode are also supplied parameters. The new layer still needs to be added to the image, as this is not automatic. Add the new layer with the 'gimp_image_add_layer' command. Other attributes such as layer mask modes, and offsets should be set with explicit procedure calls.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_resize
Input:
| LAYER | layer | The layer |
| INT32 | new_width | New layer width: (0 < new_width) |
| INT32 | new_height | New layer height: (0 < new_height) |
| INT32 | offx | x offset between upper left corner of old and new layers: (new - old) |
| INT32 | offy | y offset between upper left corner of old and new layers: (new - old) |
Returns: nothing
This procedure resizes the layer so that it's new width and height are equal to the supplied parameters. Offsets are also provided which describe the position of the previous layer's content. This operation only works if the layer has been added to an image.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_scale
Input:
| LAYER | layer | The layer |
| INT32 | new_width | New layer width: (0 < new_width) |
| INT32 | new_height | New layer height: (0 < new_height) |
| INT32 | local_origin | Use a local origin (as opposed to the image origin) |
Returns: nothing
This procedure scales the layer so that it's new width and height are equal to the supplied parameters. The "local_origin" parameter specifies whether to scale from the center of the layer, or from the image origin. This operation only works if the layer has been added to an image.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_set_apply_mask
Input:
| LAYER | layer | The layer |
| INT32 | apply_mask | The new layer's apply mask setting |
Returns: nothing
This procedure sets the specified layer's apply mask setting. This controls whether the layer's mask is currently affecting the alpha channel. If there is no layer mask, this function will return an error.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_set_edit_mask
Input:
| LAYER | layer | The layer |
| INT32 | edit_mask | The new layer's show mask setting |
Returns: nothing
This procedure sets the specified layer's show mask setting. This controls whether the layer or it's mask is currently active for editing. If the specified layer has no layer mask, then this procedure will return an error.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_set_linked
Input:
| LAYER | layer | The layer |
| INT32 | linked | The new layer linked state |
Returns: nothing
This procedure sets the specified layer's linked state.
Wolfgang Hofer; 1998
gimp_layer_set_mode
Input:
| LAYER | layer | The layer |
| INT32 | mode | The new layer combination mode |
Returns: nothing
This procedure sets the specified layer's combination mode.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_set_name
Input:
| LAYER | layer | The layer |
| STRING | name | The new layer name |
Returns: nothing
This procedure sets the specified layer's name.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_set_offsets
Input:
| LAYER | layer | The layer |
| INT32 | offx | Offset in x direction |
| INT32 | offy | Offset in y direction |
Returns: nothing
This procedure sets the offsets for the specified layer. The offsets are relative to the image origin and can be any values. This operation is valid only on layers which have been added to an image.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_set_opacity
Input:
| LAYER | layer | The layer |
| FLOAT | opacity | The new layer opacity (0 <= opacity <= 100) |
Returns: nothing
This procedure sets the specified layer's opacity.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_set_preserve_trans
Input:
| LAYER | layer | The layer |
| INT32 | preserve_trans | The new layer's preserve transperancy setting |
Returns: nothing
This procedure sets the specified layer's preserve transperancy setting.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_set_show_mask
Input:
| LAYER | layer | The layer |
| INT32 | show_mask | The new layer's show mask setting |
Returns: nothing
This procedure sets the specified layer's show mask setting. This controls whether the layer or it's mask is visible. Non-zero values indicate that the mask should be visible. If the layer has no mask, then this function returns an error.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_set_tattoo
Input:
| LAYER | layer | The layer |
| INT32 | tattoo | The new layer tattoo |
Returns: nothing
This procedure sets the specified layer's tattoo. A tattoo is a unique and permanent identifier attached to a layer that can be used to uniquely identify a layer within an image even between sessions
Jay Cox; 1998
gimp_layer_set_visible
Input:
| LAYER | layer | The layer |
| INT32 | visible | The new layer visibility |
Returns: nothing
This procedure sets the specified layer's visibility.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_layer_translate
Input:
| LAYER | layer | The layer |
| INT32 | offx | Offset in x direction |
| INT32 | offy | Offset in y direction |
Returns: nothing
This procedure translates the layer by the amounts specified in the x and y arguments. These can be negative, and are considered offsets from the current position. This command only works if the layer has been added to an image. All additional layers contained in the image which have the linked flag set to TRUE w ill also be translated by the specified offsets.
Spencer Kimball & Peter Mattis; 1995-1996
gimp_selection_layer_alpha
Input:
| LAYER | layer | Layer with alpha |
Returns: nothing
This procedure requires a layer with an alpha channel. The alpha channel information is used to create a selection mask such that for any pixel in the image defined in the specified layer, that layer pixel's alpha value is transferred to the selection mask. If the layer is undefined at a particular image pixel, the associated selection mask value is set to 0.
Spencer Kimball & Peter Mattis; 1995-1996
plug_in_align_layers
Input:
| INT32 | run_mode | Interactive, non-interactive |
| IMAGE | image | Input image |
| DRAWABLE | drawable | Input drawable (not used) |
| INT32 | link-afteer-alignment | Link the visible layers after alignment |
| INT32 | use-bottom | use the bottom layer as the base of alignment |
Returns: nothing
Align visible layers
Shuji Narazaki; 1997
plug_in_gap_layers_run_animfilter
Input:
| INT32 | run_mode | Interactive, non-interactive |
| IMAGE | image | Input image |
| DRAWABLE | drawable | Input drawable (unused) |
| STRING | proc_name | name of plugin procedure to run for each layer) |
Returns: nothing
blurb repeated: This plugin calls another plugin for each layer of an image, varying its settings (to produce animated effects). The called plugin must work on a single drawable and must be able to GIMP_RUN_WITH_LAST_VALS
Wolfgang Hofer; 0.92.01; 2000/11/30
plug_in_gap_range_layer_del
Input:
| INT32 | run_mode | Interactive, non-interactive |
| IMAGE | image | Input image (one of the Anim Frames) |
| DRAWABLE | drawable | Input drawable (unused) |
| INT32 | range_from | frame nr to start |
| INT32 | range_to | frame nr to stop (can be lower than range_from) |
| INT32 | nr | layerstack position (0 == on top) |
Returns: nothing
blurb repeated: This plugin deletes one layer in the given range of frame-images (on disk). exception: the last remaining layer of a frame is not deleted
Wolfgang Hofer; 1.1.29b; 2000/11/30
plug_in_gap_range_to_multilayer
Input:
| INT32 | run_mode | Interactive, non-interactive |
| IMAGE | image | Input image (one of the Anim Frames) |
| DRAWABLE | drawable | Input drawable (unused) |
| INT32 | range_from | frame nr to start |
| INT32 | range_to | frame nr to stop (can be lower than range_from) |
| INT32 | flatten_mode | { expand-as-necessary(0), CLIP-TO_IMG(1), CLIP-TO-BG-LAYER(2), FLATTEN(3) } |
| INT32 | bg_visible | { BG_NOT_VISIBLE (0), BG_VISIBLE(1) } |
| INT32 | framerate | frame delaytime in ms |
| STRING | frame_basename | basename for all generated layers |
| INT32 | select_mode | Mode how to identify a layer: 0-3 by layername 0=equal, 1=prefix, 2=suffix, 3=contains, 4=layerstack_numberslist, 5=inv_layerstack, 6=all_visible |
| INT32 | select_case | 0: ignore case 1: select_string is case sensitive |
| INT32 | select_invert | 0: select normal 1: invert (select all unselected layers) |
| STRING | select_string | string to match with layername (how to match is defined by select_mode) |
Returns:
| IMAGE | new_image | Output image |
blurb repeated: This plugin creates a new image from the given range of frame-images. Each frame is converted to one layer in the new image, according to flatten_mode. (the frames on disk are not changed).
Wolfgang Hofer; 1.1.29b; 2000/11/30
plug_in_layer_rot180
Input:
| INT32 | run_mode | Interactive, non-interactive |
| IMAGE | image | Input image |
| DRAWABLE | drawable | Input drawable |
Returns: nothing
Rotates the given layer 180 degrees.
Sven Neumann, Adam D. Moss; v1.0 (2000/06/18)
plug_in_layer_rot270
Input:
| INT32 | run_mode | Interactive, non-interactive |
| IMAGE | image | Input image |
| DRAWABLE | drawable | Input drawable |
Returns: nothing
Rotates the given layer 270 degrees clockwise.
Sven Neumann, Adam D. Moss; v1.0 (2000/06/18)
plug_in_layer_rot90
Input:
| INT32 | run_mode | Interactive, non-interactive |
| IMAGE | image | Input image |
| DRAWABLE | drawable | Input drawable |
Returns: nothing
Rotates the given layer 90 degrees clockwise.
Sven Neumann, Adam D. Moss; v1.0 (2000/06/18)
script_fu_asc_2_img_layer
Input:
| INT32 | run_mode | Interactive, non-interactive |
| IMAGE | image | Image |
| DRAWABLE | drawable | Layer |
| STRING | filename | Filename |
| STRING | font | Font |
| STRING | value | Font Size (pixels) |
| COLOR | color | Text Color |
Returns: nothing
Create a new layer of text from a simple text file
30th April 1998; Chris Gutteridge / ECS @ University of Southampton, England