Gimp.Drawable¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gimp.Drawable(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
Functions to manipulate drawables.
- classmethod get_by_id(drawable_id)¶
- Parameters:
drawable_id (
int
) – The drawable id.- Returns:
a
Gimp.Drawable
for drawable_id orNone
if drawable_id does not represent a valid drawable. The object belongs to libgimp and you must not modify or unref it.- Return type:
Returns a
Gimp.Drawable
representing drawable_id. This function callsGimp.Item.get_by_id
() and returns the item if it is drawable orNone
otherwise.New in version 3.0.
- append_filter(filter)¶
- Parameters:
filter (
Gimp.DrawableFilter
) – The drawable filter to append.
This procedure appends the specified drawable effect at the top of the effect list of self.
The self argument must be the same as the one used when you created the effect with [ctor`Gimp`.DrawableFilter.new]. Some effects may be slower than others to render. In order to minimize processing time, it is preferred to customize the operation’s arguments as received with [method`Gimp`.DrawableFilter.get_config] before adding the effect.
New in version 3.0.
- brightness_contrast(brightness, contrast)¶
- Parameters:
- Returns:
True
on success.- Return type:
Modify brightness/contrast in the specified drawable.
This procedures allows the brightness and contrast of the specified drawable to be modified. Both ‘brightness’ and ‘contrast’ parameters are defined between -1.0 and 1.0.
New in version 2.10.
- color_balance(transfer_mode, preserve_lum, cyan_red, magenta_green, yellow_blue)¶
- Parameters:
transfer_mode (
Gimp.TransferMode
) – Transfer mode.preserve_lum (
bool
) – Preserve luminosity values at each pixel.cyan_red (
float
) – Cyan-Red color balance.magenta_green (
float
) – Magenta-Green color balance.yellow_blue (
float
) – Yellow-Blue color balance.
- Returns:
True
on success.- Return type:
Modify the color balance of the specified drawable.
Modify the color balance of the specified drawable. There are three axis which can be modified: cyan-red, magenta-green, and yellow-blue. Negative values increase the amount of the former, positive values increase the amount of the latter. Color balance can be controlled with the ‘transfer_mode’ setting, which allows shadows, mid-tones, and highlights in an image to be affected differently. The ‘preserve-lum’ parameter, if
True
, ensures that the luminosity of each pixel remains fixed.New in version 2.10.
- colorize_hsl(hue, saturation, lightness)¶
- Parameters:
- Returns:
True
on success.- Return type:
Render the drawable as a grayscale image seen through a colored glass.
Desaturates the drawable, then tints it with the specified color. This tool is only valid on RGB color images. It will not operate on grayscale drawables.
New in version 2.10.
- curves_explicit(channel, values)¶
- Parameters:
channel (
Gimp.HistogramChannel
) – The channel to modify.values ([
float
]) – The explicit curve.
- Returns:
True
on success.- Return type:
Modifies the intensity curve(s) for specified drawable.
Modifies the intensity mapping for one channel in the specified drawable. The channel can be either an intensity component, or the value. The ‘values’ parameter is an array of doubles which explicitly defines how each pixel value in the drawable will be modified. Use the
Gimp.Drawable.curves_spline
() function to modify intensity levels with Catmull Rom splines.New in version 2.10.
- curves_spline(channel, points)¶
- Parameters:
channel (
Gimp.HistogramChannel
) – The channel to modify.points ([
float
]) – The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y, … }.
- Returns:
True
on success.- Return type:
Modifies the intensity curve(s) for specified drawable.
Modifies the intensity mapping for one channel in the specified drawable. The channel can be either an intensity component, or the value. The ‘points’ parameter is an array of doubles which define a set of control points which describe a Catmull Rom spline which yields the final intensity curve. Use the
Gimp.Drawable.curves_explicit
() function to explicitly modify intensity levels.New in version 2.10.
- desaturate(desaturate_mode)¶
- Parameters:
desaturate_mode (
Gimp.DesaturateMode
) – The formula to use to desaturate.- Returns:
True
on success.- Return type:
Desaturate the contents of the specified drawable, with the specified formula.
This procedure desaturates the contents of the specified drawable, with the specified formula. This procedure only works on drawables of type RGB color.
New in version 2.10.
- edit_bucket_fill(fill_type, x, y)¶
- Parameters:
fill_type (
Gimp.FillType
) – The type of fill.x (
float
) – The x coordinate of this bucket fill’s application.y (
float
) – The y coordinate of this bucket fill’s application.
- Returns:
True
on success.- Return type:
Fill the area by a seed fill starting at the specified coordinates.
This procedure does a seed fill at the specified coordinates, using various parameters from the current context. In the case of merged sampling, the x and y coordinates are relative to the image’s origin; otherwise, they are relative to the drawable’s origin.
This procedure is affected by the following context setters:
Gimp.context_set_opacity
(),Gimp.context_set_paint_mode
(),Gimp.context_set_foreground
(),Gimp.context_set_background
(),Gimp.context_set_pattern
(),Gimp.context_set_sample_threshold
(),Gimp.context_set_sample_merged
(),Gimp.context_set_sample_criterion
(),Gimp.context_set_diagonal_neighbors
(),Gimp.context_set_antialias
().New in version 2.10.
- edit_clear()¶
-
Clear selected area of drawable.
This procedure clears the specified drawable. If the drawable has an alpha channel, the cleared pixels will become transparent. If the drawable does not have an alpha channel, cleared pixels will be set to the background color. This procedure only affects regions within a selection if there is a selection active.
This procedure is affected by the following context setters:
Gimp.context_set_background
().
- edit_fill(fill_type)¶
- Parameters:
fill_type (
Gimp.FillType
) – The type of fill.- Returns:
True
on success.- Return type:
Fill selected area of drawable.
This procedure fills the specified drawable according to fill mode. This procedure only affects regions within a selection if there is a selection active. If you want to fill the whole drawable, regardless of the selection, use
Gimp.Drawable.fill
().This procedure is affected by the following context setters:
Gimp.context_set_opacity
(),Gimp.context_set_paint_mode
(),Gimp.context_set_foreground
(),Gimp.context_set_background
(),Gimp.context_set_pattern
().
- edit_gradient_fill(gradient_type, offset, supersample, supersample_max_depth, supersample_threshold, dither, x1, y1, x2, y2)¶
- Parameters:
gradient_type (
Gimp.GradientType
) – The type of gradient.offset (
float
) – Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode dependent.supersample (
bool
) – Do adaptive supersampling.supersample_max_depth (
int
) – Maximum recursion levels for supersampling.supersample_threshold (
float
) – Supersampling threshold.dither (
bool
) – Use dithering to reduce banding.x1 (
float
) – The x coordinate of this gradient’s starting point.y1 (
float
) – The y coordinate of this gradient’s starting point.x2 (
float
) – The x coordinate of this gradient’s ending point.y2 (
float
) – The y coordinate of this gradient’s ending point.
- Returns:
True
on success.- Return type:
Draw a gradient between the starting and ending coordinates with the specified gradient type.
This tool requires information on the gradient type. It creates the specified variety of gradient using the starting and ending coordinates as defined for each gradient type. For shapeburst gradient types, the context’s distance metric is also relevant and can be updated with
Gimp.context_set_distance_metric
().This procedure is affected by the following context setters:
Gimp.context_set_opacity
(),Gimp.context_set_paint_mode
(),Gimp.context_set_foreground
(),Gimp.context_set_background
(),Gimp.context_set_gradient
() and all gradient property settings,Gimp.context_set_distance_metric
().New in version 2.10.
- edit_stroke_item(item)¶
-
Stroke the specified item
This procedure strokes the specified item, painting along its outline (e.g. along a path, or along a channel’s boundary), with the active paint method and brush, or using a plain line with configurable properties.
This procedure is affected by the following context setters:
Gimp.context_set_opacity
(),Gimp.context_set_paint_mode
(),Gimp.context_set_paint_method
(),Gimp.context_set_stroke_method
(),Gimp.context_set_foreground
(),Gimp.context_set_brush
() and all brush property settings,Gimp.context_set_gradient
() and all gradient property settings,Gimp.context_set_line_width
() and all line property settings,Gimp.context_set_antialias
().New in version 2.10.
- edit_stroke_selection()¶
-
Stroke the current selection
This procedure strokes the current selection, painting along the selection boundary with the active paint method and brush, or using a plain line with configurable properties. The paint is applied to the specified drawable regardless of the active selection.
This procedure is affected by the following context setters:
Gimp.context_set_opacity
(),Gimp.context_set_paint_mode
(),Gimp.context_set_paint_method
(),Gimp.context_set_stroke_method
(),Gimp.context_set_foreground
(),Gimp.context_set_brush
() and all brush property settings,Gimp.context_set_gradient
() and all gradient property settings,Gimp.context_set_line_width
() and all line property settings,Gimp.context_set_antialias
().
- equalize(mask_only)¶
-
Equalize the contents of the specified drawable.
This procedure equalizes the contents of the specified drawable. Each intensity channel is equalized independently. The equalized intensity is given as inten’ = (255 - inten). The ‘mask_only’ option specifies whether to adjust only the area of the image within the selection bounds, or the entire image based on the histogram of the selected area. If there is no selection, the entire image is adjusted based on the histogram for the entire image.
New in version 2.10.
- extract_component(component, invert, linear)¶
- Parameters:
component (
int
) – Component (RGB Red (0), RGB Green (1), RGB Blue (2), Hue (3), HSV Saturation (4), HSV Value (5), HSL Saturation (6), HSL Lightness (7), CMYK Cyan (8), CMYK Magenta (9), CMYK Yellow (10), CMYK Key (11), Y’CbCr Y’ (12), Y’CbCr Cb (13), Y’CbCr Cr (14), LAB L (15), LAB A (16), LAB B (17), LCH C(ab) (18), LCH H(ab) (19), Alpha (20)).invert (
bool
) – Invert the extracted component.linear (
bool
) – Use linear output instead of gamma corrected.
- Returns:
True
on success.- Return type:
Extract a color model component.
Extract a color model component.
New in version 2.10.34.
- fill(fill_type)¶
- Parameters:
fill_type (
Gimp.FillType
) – The type of fill.- Returns:
True
on success.- Return type:
Fill the drawable with the specified fill mode.
This procedure fills the drawable. If the fill mode is foreground the current foreground color is used. If the fill mode is background, the current background color is used. If the fill type is white, then white is used. Transparent fill only affects layers with an alpha channel, in which case the alpha channel is set to transparent. If the drawable has no alpha channel, it is filled to white. No fill leaves the drawable’s contents undefined. This procedure is unlike
Gimp.Drawable.edit_fill
() or the bucket fill tool because it fills regardless of a selection. Its main purpose is to fill a newly created drawable before adding it to the image. This operation cannot be undone.
- foreground_extract(mode, mask)¶
- Parameters:
mode (
Gimp.ForegroundExtractMode
) – The algorithm to use.mask (
Gimp.Drawable
) – Tri-Map.
- Returns:
True
on success.- Return type:
Extract the foreground of a drawable using a given trimap.
Image Segmentation by Uniform Color Clustering, see https://www.inf.fu-berlin.de/inst/pubs/tr-b-05-07.pdf
New in version 2.4.
- free_shadow()¶
-
Free the specified drawable’s shadow data (if it exists).
This procedure is intended as a memory saving device. If any shadow memory has been allocated, it will be freed automatically when the drawable is removed from the image, or when the plug-in procedure which allocated it returns.
New in version 2.6.
- get_bpp()¶
- Returns:
Bytes per pixel.
- Return type:
Returns the bytes per pixel.
This procedure returns the number of bytes per pixel.
- get_buffer()¶
- Returns:
The
Gegl.Buffer
.See Also:
Gimp.Drawable.get_shadow_buffer
()- Return type:
Returns a
Gegl.Buffer
of a specified drawable. The buffer can be used like any other GEGL buffer. Its data will we synced back with the core drawable when the buffer gets destroyed, or whenGegl.Buffer.flush
() is called.New in version 2.10.
- get_filters()¶
- Returns:
The list of filters on the drawable. The returned value must be freed with
GLib.free
().- Return type:
Returns the list of filters applied to the drawable.
This procedure returns the list of filters which are currently applied non-destructively to self. The order of filters is from topmost to bottommost.
New in version 3.0.
- get_format()¶
- Returns:
The
Babl.Object
format.- Return type:
Returns the
Babl.Object
format of the drawable.New in version 2.10.
- get_height()¶
- Returns:
Height of drawable.
- Return type:
Returns the height of the drawable.
This procedure returns the specified drawable’s height in pixels.
- get_offsets()¶
- Returns:
True
on success.- offset_x:
x offset of drawable.
- offset_y:
y offset of drawable.
- Return type:
Returns the offsets for the drawable.
This procedure returns the specified drawable’s offsets. This only makes sense if the drawable is a layer since channels are anchored. The offsets of a channel will be returned as 0.
- get_pixel(x_coord, y_coord)¶
- Parameters:
- Returns:
The pixel color.
- Return type:
Gets the value of the pixel at the specified coordinates.
This procedure gets the pixel value at the specified coordinates.
- get_shadow_buffer()¶
- Returns:
The
Gegl.Buffer
.- Return type:
Returns a
Gegl.Buffer
of a specified drawable’s shadow tiles. The buffer can be used like any other GEGL buffer. Its data will we synced back with the core drawable’s shadow tiles when the buffer gets destroyed, or whenGegl.Buffer.flush
() is called.New in version 2.10.
- get_sub_thumbnail(src_x, src_y, src_width, src_height, dest_width, dest_height, alpha)¶
- Parameters:
src_x (
int
) – the x coordinate of the areasrc_y (
int
) – the y coordinate of the areasrc_width (
int
) – the width of the areasrc_height (
int
) – the height of the areadest_width (
int
) – the requested thumbnail width (<= 1024 pixels)dest_height (
int
) – the requested thumbnail height (<= 1024 pixels)alpha (
Gimp.PixbufTransparency
) – how to handle an alpha channel
- Returns:
a new
GdkPixbuf.Pixbuf
- Return type:
Retrieves a thumbnail pixbuf for the drawable identified by self. The thumbnail will be not larger than the requested size.
New in version 2.2.
- get_sub_thumbnail_data(src_x, src_y, src_width, src_height, dest_width, dest_height)¶
- Parameters:
src_x (
int
) – the x coordinate of the areasrc_y (
int
) – the y coordinate of the areasrc_width (
int
) – the width of the areasrc_height (
int
) – the height of the areadest_width (
int
) – the requested thumbnail width (<= 1024 pixels)dest_height (
int
) – the requested thumbnail height (<= 1024 pixels)
- Returns:
thumbnail data or
None
if self is invalid.- actual_width:
the width of the returned thumbnail
- actual_height:
the height of the returned thumbnail
- bpp:
the bytes per pixel of the returned thumbnail data
- Return type:
(
GLib.Bytes
, actual_width:int
, actual_height:int
, bpp:int
)
Retrieves thumbnail data for the drawable identified by self. The thumbnail will be not larger than the requested size.
- get_thumbnail(width, height, alpha)¶
- Parameters:
width (
int
) – the requested thumbnail width (<= 1024 pixels)height (
int
) – the requested thumbnail height (<= 1024 pixels)alpha (
Gimp.PixbufTransparency
) – how to handle an alpha channel
- Returns:
a new
GdkPixbuf.Pixbuf
- Return type:
Retrieves a thumbnail pixbuf for the drawable identified by self. The thumbnail will be not larger than the requested size.
New in version 2.2.
- get_thumbnail_data(width, height)¶
- Parameters:
- Returns:
thumbnail data or
None
if self is invalid.- actual_width:
the resulting thumbnail’s actual width
- actual_height:
the resulting thumbnail’s actual height
- bpp:
the bytes per pixel of the returned thubmnail data
- Return type:
(
GLib.Bytes
orNone
, actual_width:int
, actual_height:int
, bpp:int
)
Retrieves thumbnail data for the drawable identified by self. The thumbnail will be not larger than the requested size.
- get_thumbnail_format()¶
- Returns:
The
Babl.Object
thumbnail format.- Return type:
Returns the
Babl.Object
thumbnail format of the drawable.New in version 2.10.14.
- get_width()¶
- Returns:
Width of drawable.
- Return type:
Returns the width of the drawable.
This procedure returns the specified drawable’s width in pixels.
- has_alpha()¶
- Returns:
Does the drawable have an alpha channel?
- Return type:
Returns
True
if the drawable has an alpha channel.This procedure returns whether the specified drawable has an alpha channel. This can only be true for layers, and the associated type will be one of: { RGBA , GRAYA, INDEXEDA }.
- histogram(channel, start_range, end_range)¶
- Parameters:
channel (
Gimp.HistogramChannel
) – The channel to query.start_range (
float
) – Start of the intensity measurement range.end_range (
float
) – End of the intensity measurement range.
- Returns:
True
on success.- mean:
Mean intensity value.
- std_dev:
Standard deviation of intensity values.
- median:
Median intensity value.
- pixels:
Alpha-weighted pixel count for entire image.
- count:
Alpha-weighted pixel count for range.
- percentile:
Percentile that range falls under.
- Return type:
(
bool
, mean:float
, std_dev:float
, median:float
, pixels:float
, count:float
, percentile:float
)
Returns information on the intensity histogram for the specified drawable.
This tool makes it possible to gather information about the intensity histogram of a drawable. A channel to examine is first specified. This can be either value, red, green, or blue, depending on whether the drawable is of type color or grayscale. Second, a range of intensities are specified. The
Gimp.Drawable.histogram
() function returns statistics based on the pixels in the drawable that fall under this range of values. Mean, standard deviation, median, number of pixels, and percentile are all returned. Additionally, the total count of pixels in the image is returned. Counts of pixels are weighted by any associated alpha values and by the current selection mask. That is, pixels that lie outside an active selection mask will not be counted. Similarly, pixels with transparent alpha values will not be counted. The returned mean, std_dev and median are in the range (0..255) for 8-bit images or if the plug-in is not precision-aware, and in the range (0.0..1.0) otherwise.New in version 2.10.
- hue_saturation(hue_range, hue_offset, lightness, saturation, overlap)¶
- Parameters:
hue_range (
Gimp.HueRange
) – Range of affected hues.hue_offset (
float
) – Hue offset in degrees.lightness (
float
) – Lightness modification.saturation (
float
) – Saturation modification.overlap (
float
) – Overlap other hue channels.
- Returns:
True
on success.- Return type:
Modify hue, lightness, and saturation in the specified drawable.
This procedure allows the hue, lightness, and saturation in the specified drawable to be modified. The ‘hue-range’ parameter provides the capability to limit range of affected hues. The ‘overlap’ parameter provides blending into neighboring hue channels when rendering.
New in version 2.10.
- invert(linear)¶
- Parameters:
linear (
bool
) – Whether to invert in linear space.- Returns:
True
on success.- Return type:
Invert the contents of the specified drawable.
This procedure inverts the contents of the specified drawable. Each intensity channel is inverted independently. The inverted intensity is given as inten’ = (255 - inten). If ‘linear’ is
True
, the drawable is inverted in linear space.New in version 2.10.
- is_gray()¶
-
Returns whether the drawable is a grayscale type.
This procedure returns
True
if the specified drawable is of type { Gray, GrayA }.
- is_indexed()¶
-
Returns whether the drawable is an indexed type.
This procedure returns
True
if the specified drawable is of type { Indexed, IndexedA }.
- is_rgb()¶
-
Returns whether the drawable is an RGB type.
This procedure returns
True
if the specified drawable is of type { RGB, RGBA }.
- levels(channel, low_input, high_input, clamp_input, gamma, low_output, high_output, clamp_output)¶
- Parameters:
channel (
Gimp.HistogramChannel
) – The channel to modify.low_input (
float
) – Intensity of lowest input.high_input (
float
) – Intensity of highest input.clamp_input (
bool
) – Clamp input values before applying output levels.gamma (
float
) – Gamma adjustment factor.low_output (
float
) – Intensity of lowest output.high_output (
float
) – Intensity of highest output.clamp_output (
bool
) – Clamp final output values.
- Returns:
True
on success.- Return type:
Modifies intensity levels in the specified drawable.
This tool allows intensity levels in the specified drawable to be remapped according to a set of parameters. The low/high input levels specify an initial mapping from the source intensities. The gamma value determines how intensities between the low and high input intensities are interpolated. A gamma value of 1.0 results in a linear interpolation. Higher gamma values result in more high-level intensities. Lower gamma values result in more low-level intensities. The low/high output levels constrain the final intensity mapping–that is, no final intensity will be lower than the low output level and no final intensity will be higher than the high output level. This tool is only valid on RGB color and grayscale images.
New in version 2.10.
- levels_stretch()¶
-
Automatically modifies intensity levels in the specified drawable.
This procedure allows intensity levels in the specified drawable to be remapped according to a set of guessed parameters. It is equivalent to clicking the \”Auto\” button in the Levels tool.
New in version 2.10.
- mask_bounds()¶
- Returns:
True
if there is a selection.- x1:
x coordinate of the upper left corner of selection bounds.
- y1:
y coordinate of the upper left corner of selection bounds.
- x2:
x coordinate of the lower right corner of selection bounds.
- y2:
y coordinate of the lower right corner of selection bounds.
- Return type:
Find the bounding box of the current selection in relation to the specified drawable.
This procedure returns whether there is a selection. If there is one, the upper left and lower right-hand corners of its bounding box are returned. These coordinates are specified relative to the drawable’s origin, and bounded by the drawable’s extents. Please note that the pixel specified by the lower right-hand coordinate of the bounding box is not part of the selection. The selection ends at the upper left corner of this pixel. This means the width of the selection can be calculated as (x2 - x1), its height as (y2 - y1). Note that the returned boolean does NOT correspond with the returned region being empty or not, it always returns whether the selection is non_empty. See
Gimp.Drawable.mask_intersect
() for a boolean return value which is more useful in most cases.
- mask_intersect()¶
- Returns:
True
if the returned area is not empty.- x:
x coordinate of the upper left corner of the intersection.
- y:
y coordinate of the upper left corner of the intersection.
- width:
width of the intersection.
- height:
height of the intersection.
- Return type:
Find the bounding box of the current selection in relation to the specified drawable.
This procedure returns whether there is an intersection between the drawable and the selection. Unlike
Gimp.Drawable.mask_bounds
(), the intersection’s bounds are returned as x, y, width, height. If there is no selection this function returnsTrue
and the returned bounds are the extents of the whole drawable.New in version 2.2.
- merge_filter(filter)¶
- Parameters:
filter (
Gimp.DrawableFilter
) – The drawable filter to merge.
This procedure applies the specified drawable effect on self and merge it (therefore before any non-destructive effects are computed).
The self argument must be the same as the one used when you created the effect with [ctor`Gimp`.DrawableFilter.new]. Once this is run, filter is not valid anymore and you should not try to do anything with it. In particular, you must customize the operation’s arguments as received with [method`Gimp`.DrawableFilter.get_config] or set the filter’s opacity and blend mode before merging the effect.
New in version 3.0.
- merge_filters()¶
-
Merge the layer effect filters to the specified drawable.
This procedure combines the contents of the drawable’s filter stack (for export) with the specified drawable.
- merge_shadow(undo)¶
-
Merge the shadow buffer with the specified drawable.
This procedure combines the contents of the drawable’s shadow buffer (for temporary processing) with the specified drawable. The ‘undo’ parameter specifies whether to add an undo step for the operation. Requesting no undo is useful for such applications as ‘auto-apply’.
- offset(wrap_around, fill_type, color, offset_x, offset_y)¶
- Parameters:
wrap_around (
bool
) – wrap image around or fill vacated regions.fill_type (
Gimp.OffsetType
) – fill vacated regions of drawable with background or transparent.color (
Gegl.Color
) – fills in the background color when fill_type is set to OFFSET-COLOR.offset_x (
int
) – offset by this amount in X direction.offset_y (
int
) – offset by this amount in Y direction.
- Returns:
True
on success.- Return type:
Offset the drawable by the specified amounts in the X and Y directions
This procedure offsets the specified drawable by the amounts specified by ‘offset_x’ and ‘offset_y’. If ‘wrap_around’ is set to
True
, then portions of the drawable which are offset out of bounds are wrapped around. Alternatively, the undefined regions of the drawable can be filled with transparency or the background color, as specified by the ‘fill-type’ parameter.
- posterize(levels)¶
-
Posterize the specified drawable.
This procedures reduces the number of shades allows in each intensity channel to the specified ‘levels’ parameter.
New in version 2.10.
- set_pixel(x_coord, y_coord, color)¶
- Parameters:
x_coord (
int
) – The x coordinate.y_coord (
int
) – The y coordinate.color (
Gegl.Color
) – The pixel color.
- Returns:
True
on success.- Return type:
Sets the value of the pixel at the specified coordinates.
This procedure sets the pixel value at the specified coordinates. Note that this function is not undoable, you should use it only on drawables you just created yourself.
- shadows_highlights(shadows, highlights, whitepoint, radius, compress, shadows_ccorrect, highlights_ccorrect)¶
- Parameters:
shadows (
float
) – Adjust exposure of shadows.highlights (
float
) – Adjust exposure of highlights.whitepoint (
float
) – Shift white point.radius (
float
) – Spatial extent.compress (
float
) – Compress the effect on shadows/highlights and preserve midtones.shadows_ccorrect (
float
) – Adjust saturation of shadows.highlights_ccorrect (
float
) – Adjust saturation of highlights.
- Returns:
True
on success.- Return type:
Perform shadows and highlights correction.
This filter allows adjusting shadows and highlights in the image separately. The implementation closely follow its counterpart in the Darktable photography software.
New in version 2.10.34.
- threshold(channel, low_threshold, high_threshold)¶
- Parameters:
channel (
Gimp.HistogramChannel
) – The channel to base the threshold on.low_threshold (
float
) – The low threshold value.high_threshold (
float
) – The high threshold value.
- Returns:
True
on success.- Return type:
Threshold the specified drawable.
This procedures generates a threshold map of the specified drawable. All pixels between the values of ‘low_threshold’ and ‘high_threshold’, on the scale of ‘channel’ are replaced with white, and all other pixels with black.
New in version 2.10.
- type()¶
- Returns:
The drawable’s type.
- Return type:
Returns the drawable’s type.
This procedure returns the drawable’s type.
- type_with_alpha()¶
- Returns:
The drawable’s type with alpha.
- Return type:
Returns the drawable’s type with alpha.
This procedure returns the drawable’s type as if had an alpha channel. If the type is currently Gray, for instance, the returned type would be GrayA. If the drawable already has an alpha channel, the drawable’s type is simply returned.
- update(x, y, width, height)¶
- Parameters:
- Returns:
True
on success.- Return type:
Update the specified region of the drawable.
This procedure updates the specified region of the drawable. The (x, y) coordinate pair is relative to the drawable’s origin, not to the image origin. Therefore, the entire drawable can be updated using (0, 0, width, height).