Gimp.Channel

g GObject.Object GObject.Object Gimp.Item Gimp.Item GObject.Object->Gimp.Item Gimp.Channel Gimp.Channel Gimp.Drawable Gimp.Drawable Gimp.Drawable->Gimp.Channel Gimp.Item->Gimp.Drawable

Subclasses:

Gimp.LayerMask, Gimp.Selection

Methods

Inherited:

Gimp.Drawable (55), Gimp.Item (55), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

get_by_id (channel_id)

class

new (image, name, width, height, opacity, color)

class

new_from_component (image, component, name)

combine_masks (channel2, operation, offx, offy)

copy ()

get_color ()

get_opacity ()

get_show_masked ()

set_color (color)

set_opacity (opacity)

set_show_masked (show_masked)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

Gimp.Item (1)

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

Gimp.Drawable

r

Class Details

class Gimp.Channel(**kwargs)
Bases:

Gimp.Drawable

Abstract:

No

Structure:

Gimp.ChannelClass

Functions for manipulating channels.

classmethod get_by_id(channel_id)
Parameters:

channel_id (int) – The channel id.

Returns:

a Gimp.Channel for channel_id or None if channel_id does not represent a valid channel. The object belongs to libgimp and you must not modify or unref it.

Return type:

Gimp.Channel or None

Returns a Gimp.Channel representing channel_id. This function calls Gimp.Item.get_by_id() and returns the item if it is channel or None otherwise.

New in version 3.0.

classmethod new(image, name, width, height, opacity, color)
Parameters:
  • image (Gimp.Image) – The image to which to add the channel.

  • name (str) – The channel name.

  • width (int) – The channel width.

  • height (int) – The channel height.

  • opacity (float) – The channel opacity.

  • color (Gegl.Color) – The channel compositing color.

Returns:

The newly created channel.

Return type:

Gimp.Channel

Create a new channel.

This procedure creates a new channel with the specified width, height, name, opacity and color.

Other attributes, such as channel visibility, should be set with explicit procedure calls.

The new channel still needs to be added to the image, as this is not automatic. Add the new channel with [method`Gimp`.Image.insert_channel].

The channel’s contents are undefined initially.

classmethod new_from_component(image, component, name)
Parameters:
  • image (Gimp.Image) – The image to which to add the channel.

  • component (Gimp.ChannelType) – The image component.

  • name (str) – The channel name.

Returns:

The newly created channel.

Return type:

Gimp.Channel

Create a new channel from a color component

This procedure creates a new channel from a color component. The new channel still needs to be added to the image, as this is not automatic. Add the new channel with Gimp.Image.insert_channel(). Other attributes, such as channel visibility, should be set with explicit procedure calls.

New in version 2.4.

combine_masks(channel2, operation, offx, offy)
Parameters:
  • channel2 (Gimp.Channel) – The channel2.

  • operation (Gimp.ChannelOps) – The selection operation.

  • offx (int) – x offset between upper left corner of channels: (second - first).

  • offy (int) – y offset between upper left corner of channels: (second - first).

Returns:

True on success.

Return type:

bool

Combine two channel masks.

This procedure combines two channel masks. The result is stored in the first channel.

copy()
Returns:

The newly copied channel.

Return type:

Gimp.Channel

Copy a channel.

This procedure copies the specified channel and returns the copy. The new channel still needs to be added to the image, as this is not automatic. Add the new channel with Gimp.Image.insert_channel().

get_color()
Returns:

The channel compositing color.

Return type:

Gegl.Color

Get the compositing color of the specified channel.

This procedure returns the specified channel’s compositing color.

get_opacity()
Returns:

The channel opacity.

Return type:

float

Get the opacity of the specified channel.

This procedure returns the specified channel’s opacity.

get_show_masked()
Returns:

The channel composite method.

Return type:

bool

Get the composite method of the specified channel.

This procedure returns the specified channel’s composite method. If it is True, then the channel is composited with the image so that masked regions are shown. Otherwise, selected regions are shown.

set_color(color)
Parameters:

color (Gegl.Color) – The new channel compositing color.

Returns:

True on success.

Return type:

bool

Set the compositing color of the specified channel.

This procedure sets the specified channel’s compositing color.

set_opacity(opacity)
Parameters:

opacity (float) – The new channel opacity.

Returns:

True on success.

Return type:

bool

Set the opacity of the specified channel.

This procedure sets the specified channel’s opacity.

set_show_masked(show_masked)
Parameters:

show_masked (bool) – The new channel composite method.

Returns:

True on success.

Return type:

bool

Set the composite method of the specified channel.

This procedure sets the specified channel’s composite method. If it is True, then the channel is composited with the image so that masked regions are shown. Otherwise, selected regions are shown.