Functions

adaptive_supersample_area (x1, y1, x2, y2, max_depth, threshold, render_func, render_data, put_pixel_func, put_pixel_data, progress_func, *progress_data)

airbrush (drawable, pressure, strokes)

airbrush_default (drawable, strokes)

attach_parasite (parasite)

babl_format_get_type ()

bilinear (x, y, values)

bilinear_16 (x, y, values)

bilinear_32 (x, y, values)

bilinear_8 (x, y, values)

bilinear_rgb (x, y, values, has_alpha, retvalues)

bind_text_domain (domain_name, dir_name)

brushes_close_popup (brush_callback)

brushes_get_list (filter)

brushes_popup (brush_callback, popup_title, initial_brush, parent_window)

brushes_refresh ()

brushes_set_popup (brush_callback, brush)

buffer_delete (buffer_name)

buffer_get_bytes (buffer_name)

buffer_get_height (buffer_name)

buffer_get_image_type (buffer_name)

buffer_get_width (buffer_name)

buffer_rename (buffer_name, new_name)

buffers_get_name_list (filter)

cache_directory ()

cairo_checkerboard_create (cr, size, light, dark)

cairo_surface_create_buffer (surface, format)

cairo_surface_get_format (surface)

canonicalize_identifier (identifier)

check_custom_color1 ()

check_custom_color2 ()

check_size ()

check_type ()

checks_get_colors (type, color1, color2)

clone (drawable, src_drawable, clone_type, src_x, src_y, strokes)

clone_default (drawable, strokes)

color_array_copy (array)

color_array_free (array)

color_array_get_length (array)

color_array_get_type ()

color_is_out_of_gamut (color, space)

color_is_out_of_self_gamut (color)

color_is_perceptually_identical (color1, color2)

color_list_names ()

color_parse_css (css)

color_parse_hex (hex)

color_parse_name (name)

color_set_alpha (color, alpha)

config_build_data_path (name)

config_build_plug_in_path (name)

config_build_system_path (name)

config_build_writable_path (name)

config_deserialize_return (scanner, expected_token, nest_level)

config_diff (a, b, flags)

config_error_quark ()

config_param_spec_duplicate (pspec)

config_reset_properties (object)

config_reset_property (object, property_name)

config_serialize_value (value, str, escaped)

config_string_append_escaped (string, val)

config_sync (src, dest, flags)

config_type_register (parent_type, type_name, pspecs)

context_are_dynamics_enabled ()

context_enable_dynamics (enable)

context_get_antialias ()

context_get_background ()

context_get_brush ()

context_get_brush_angle ()

context_get_brush_aspect_ratio ()

context_get_brush_force ()

context_get_brush_hardness ()

context_get_brush_size ()

context_get_brush_spacing ()

context_get_diagonal_neighbors ()

context_get_distance_metric ()

context_get_dynamics_name ()

context_get_emulate_brush_dynamics ()

context_get_feather ()

context_get_feather_radius ()

context_get_font ()

context_get_foreground ()

context_get_gradient ()

context_get_gradient_blend_color_space ()

context_get_gradient_repeat_mode ()

context_get_gradient_reverse ()

context_get_ink_angle ()

context_get_ink_blob_angle ()

context_get_ink_blob_aspect_ratio ()

context_get_ink_blob_type ()

context_get_ink_size ()

context_get_ink_size_sensitivity ()

context_get_ink_speed_sensitivity ()

context_get_ink_tilt_sensitivity ()

context_get_interpolation ()

context_get_line_cap_style ()

context_get_line_dash_offset ()

context_get_line_dash_pattern ()

context_get_line_join_style ()

context_get_line_miter_limit ()

context_get_line_width ()

context_get_line_width_unit ()

context_get_mypaint_brush ()

context_get_opacity ()

context_get_paint_method ()

context_get_paint_mode ()

context_get_palette ()

context_get_pattern ()

context_get_sample_criterion ()

context_get_sample_merged ()

context_get_sample_threshold ()

context_get_sample_threshold_int ()

context_get_sample_transparent ()

context_get_stroke_method ()

context_get_transform_direction ()

context_get_transform_resize ()

context_list_paint_methods ()

context_pop ()

context_push ()

context_set_antialias (antialias)

context_set_background (background)

context_set_brush (brush)

context_set_brush_angle (angle)

context_set_brush_aspect_ratio (aspect)

context_set_brush_default_hardness ()

context_set_brush_default_size ()

context_set_brush_default_spacing ()

context_set_brush_force (force)

context_set_brush_hardness (hardness)

context_set_brush_size (size)

context_set_brush_spacing (spacing)

context_set_default_colors ()

context_set_defaults ()

context_set_diagonal_neighbors (diagonal_neighbors)

context_set_distance_metric (metric)

context_set_dynamics_name (name)

context_set_emulate_brush_dynamics (emulate_dynamics)

context_set_feather (feather)

context_set_feather_radius (feather_radius_x, feather_radius_y)

context_set_font (font)

context_set_foreground (foreground)

context_set_gradient (gradient)

context_set_gradient_blend_color_space (blend_color_space)

context_set_gradient_fg_bg_hsv_ccw ()

context_set_gradient_fg_bg_hsv_cw ()

context_set_gradient_fg_bg_rgb ()

context_set_gradient_fg_transparent ()

context_set_gradient_repeat_mode (repeat_mode)

context_set_gradient_reverse (reverse)

context_set_ink_angle (angle)

context_set_ink_blob_angle (angle)

context_set_ink_blob_aspect_ratio (aspect)

context_set_ink_blob_type (type)

context_set_ink_size (size)

context_set_ink_size_sensitivity (size)

context_set_ink_speed_sensitivity (speed)

context_set_ink_tilt_sensitivity (tilt)

context_set_interpolation (interpolation)

context_set_line_cap_style (cap_style)

context_set_line_dash_offset (dash_offset)

context_set_line_dash_pattern (dashes)

context_set_line_join_style (join_style)

context_set_line_miter_limit (miter_limit)

context_set_line_width (line_width)

context_set_line_width_unit (line_width_unit)

context_set_mypaint_brush (name)

context_set_opacity (opacity)

context_set_paint_method (name)

context_set_paint_mode (paint_mode)

context_set_palette (palette)

context_set_pattern (pattern)

context_set_sample_criterion (sample_criterion)

context_set_sample_merged (sample_merged)

context_set_sample_threshold (sample_threshold)

context_set_sample_threshold_int (sample_threshold)

context_set_sample_transparent (sample_transparent)

context_set_stroke_method (stroke_method)

context_set_transform_direction (transform_direction)

context_set_transform_resize (transform_resize)

context_swap_colors ()

convolve (drawable, pressure, convolve_type, strokes)

convolve_default (drawable, strokes)

core_object_array_get_length (array)

core_object_array_get_type ()

cpu_accel_get_support ()

data_directory ()

debug_timer_end ()

debug_timer_start ()

default_display ()

detach_parasite (name)

directory ()

displays_flush ()

displays_reconnect (old_image, new_image)

dodgeburn (drawable, exposure, dodgeburn_type, dodgeburn_mode, strokes)

dodgeburn_default (drawable, strokes)

double_array_get_values (array)

double_array_set_values (array, values, static_data)

drawables_close_popup (callback)

drawables_popup (callback, popup_title, drawable_type, initial_drawable, parent_window)

drawables_set_popup (callback, drawable)

dynamics_get_name_list (filter)

dynamics_refresh ()

edit_copy (drawables)

edit_copy_visible (image)

edit_cut (drawables)

edit_named_copy (drawables, buffer_name)

edit_named_copy_visible (image, buffer_name)

edit_named_cut (drawables, buffer_name)

edit_named_paste (drawable, buffer_name, paste_into)

edit_named_paste_as_new_image (buffer_name)

edit_paste (drawable, paste_into)

edit_paste_as_new_image ()

enum_get_desc (enum_class, value)

enum_get_value (enum_type, value)

enum_get_value_descriptions (enum_type)

enum_set_value_descriptions (enum_type, descriptions)

enum_value_get_abbrev (enum_class, enum_value)

enum_value_get_desc (enum_class, enum_value)

enum_value_get_help (enum_class, enum_value)

enums_get_type_names ()

enums_init ()

eraser (drawable, strokes, hardness, method)

eraser_default (drawable, strokes)

escape_uline (str)

export_color_profile ()

export_comment ()

export_exif ()

export_iptc ()

export_thumbnail ()

export_xmp ()

file_create_thumbnail (image, file)

file_get_config_path (file)

file_get_utf8_name (file)

file_has_extension (file, extension)

file_load (run_mode, file)

file_load_layer (run_mode, image, file)

file_load_layers (run_mode, image, file)

file_new_for_config_path (path)

file_save (run_mode, image, file, options)

file_show_in_file_manager (file)

filename_to_utf8 (filename)

flags_get_first_desc (flags_class, value)

flags_get_first_value (flags_type, value)

flags_get_value_descriptions (flags_type)

flags_set_value_descriptions (flags_type, descriptions)

flags_value_get_abbrev (flags_class, flags_value)

flags_value_get_desc (flags_class, flags_value)

flags_value_get_help (flags_class, flags_value)

floating_sel_anchor (floating_sel)

floating_sel_attach (layer, drawable)

floating_sel_remove (floating_sel)

floating_sel_to_layer (floating_sel)

fonts_close_popup (font_callback)

fonts_get_list (filter)

fonts_popup (font_callback, popup_title, initial_font, parent_window)

fonts_refresh ()

fonts_set_popup (font_callback, font)

get_color_configuration ()

get_default_comment ()

get_default_unit ()

get_images ()

get_module_load_inhibit ()

get_monitor_resolution ()

get_num_processors ()

get_parasite (name)

get_parasite_list ()

get_pdb ()

get_plug_in ()

get_progname ()

getpid ()

gimprc_query (token)

gimprc_set (token, value)

gradients_close_popup (gradient_callback)

gradients_get_list (filter)

gradients_popup (gradient_callback, popup_title, initial_gradient, parent_window)

gradients_refresh ()

gradients_set_popup (gradient_callback, gradient)

heal (drawable, src_drawable, src_x, src_y, strokes)

heal_default (drawable, strokes)

help (help_domain, help_id)

icon_theme_dir ()

installation_directory ()

int32_array_get_values (array)

int32_array_set_values (array, values, static_data)

is_canonical_identifier (identifier)

locale_directory ()

main (plug_in_type, argv)

message (message)

message_get_handler ()

message_set_handler (handler)

monitor_number ()

paintbrush (drawable, fade_out, strokes, method, gradient_length)

paintbrush_default (drawable, strokes)

palettes_close_popup (palette_callback)

palettes_get_list (filter)

palettes_popup (palette_callback, popup_title, initial_palette, parent_window)

palettes_refresh ()

palettes_set_popup (palette_callback, palette)

param_spec_array (name, nick, blurb, flags)

param_spec_brush (name, nick, blurb, none_ok, default_value, default_to_context, flags)

param_spec_channel (name, nick, blurb, none_ok, flags)

param_spec_choice (name, nick, blurb, choice, default_value, flags)

param_spec_choice_get_choice (pspec)

param_spec_choice_get_default (pspec)

param_spec_color (name, nick, blurb, has_alpha, default_color, flags)

param_spec_color_from_string (name, nick, blurb, has_alpha, default_color_string, flags)

param_spec_color_has_alpha (pspec)

param_spec_config_path (name, nick, blurb, type, default_value, flags)

param_spec_config_path_type (pspec)

param_spec_core_object_array (name, nick, blurb, object_type, flags)

param_spec_core_object_array_get_object_type (pspec)

param_spec_display (name, nick, blurb, none_ok, flags)

param_spec_display_none_allowed (pspec)

param_spec_double_array (name, nick, blurb, flags)

param_spec_drawable (name, nick, blurb, none_ok, flags)

param_spec_drawable_filter (name, nick, blurb, none_ok, flags)

param_spec_drawable_filter_none_allowed (pspec)

param_spec_export_options (name, nick, blurb, flags)

param_spec_file (name, nick, blurb, action, none_ok, default_value, flags)

param_spec_file_get_action (pspec)

param_spec_file_none_allowed (pspec)

param_spec_file_set_action (pspec, action)

param_spec_font (name, nick, blurb, none_ok, default_value, default_to_context, flags)

param_spec_gradient (name, nick, blurb, none_ok, default_value, default_to_context, flags)

param_spec_group_layer (name, nick, blurb, none_ok, flags)

param_spec_image (name, nick, blurb, none_ok, flags)

param_spec_image_none_allowed (pspec)

param_spec_int32_array (name, nick, blurb, flags)

param_spec_item (name, nick, blurb, none_ok, flags)

param_spec_item_none_allowed (pspec)

param_spec_layer (name, nick, blurb, none_ok, flags)

param_spec_layer_mask (name, nick, blurb, none_ok, flags)

param_spec_matrix2 (name, nick, blurb, default_value, flags)

param_spec_matrix3 (name, nick, blurb, default_value, flags)

param_spec_memsize (name, nick, blurb, minimum, maximum, default_value, flags)

param_spec_object_duplicate (pspec)

param_spec_object_get_default (pspec)

param_spec_object_has_default (pspec)

param_spec_object_set_default (pspec, default_value)

param_spec_palette (name, nick, blurb, none_ok, default_value, default_to_context, flags)

param_spec_parasite (name, nick, blurb, flags)

param_spec_path (name, nick, blurb, none_ok, flags)

param_spec_pattern (name, nick, blurb, none_ok, default_value, default_to_context, flags)

param_spec_resource (name, nick, blurb, resource_type, none_ok, default_value, default_to_context, flags)

param_spec_resource_defaults_to_context (pspec)

param_spec_resource_none_allowed (pspec)

param_spec_selection (name, nick, blurb, none_ok, flags)

param_spec_text_layer (name, nick, blurb, none_ok, flags)

param_spec_unit (name, nick, blurb, allow_pixel, allow_percent, default_value, flags)

param_spec_unit_percent_allowed (pspec)

param_spec_unit_pixel_allowed (pspec)

param_spec_value_array (name, nick, blurb, element_spec, flags)

param_spec_value_array_get_element_spec (pspec)

patterns_close_popup (pattern_callback)

patterns_get_list (filter)

patterns_popup (pattern_callback, popup_title, initial_pattern, parent_window)

patterns_refresh ()

patterns_set_popup (pattern_callback, pattern)

pencil (drawable, strokes)

pixbuf_create_buffer (pixbuf)

pixbuf_get_format (pixbuf)

pixbuf_get_icc_profile (pixbuf)

pixels_to_units (pixels, unit, resolution)

pixpipe_params_build (params)

pixpipe_params_free (params)

pixpipe_params_init (params)

pixpipe_params_parse (parameters, params)

progress_cancel (progress_callback)

progress_end ()

progress_get_window_handle ()

progress_init (message)

progress_install_vtable (vtable, user_data, user_data_destroy)

progress_pulse ()

progress_set_text (message)

progress_uninstall (progress_callback)

progress_update (percentage)

quit ()

range_estimate_settings (lower, upper)

rectangle_intersect (x1, y1, width1, height1, x2, y2, width2, height2)

rectangle_union (x1, y1, width1, height1, x2, y2, width2, height2)

show_help_button ()

smudge (drawable, pressure, strokes)

smudge_default (drawable, strokes)

stack_trace_available (optimal)

stack_trace_print (prog_name, stream)

stack_trace_query (prog_name)

strip_uline (str)

sysconf_directory ()

temp_directory ()

temp_file (extension)

text_font (image, drawable, x, y, text, border, antialias, size, font)

text_get_extents_font (text, size, font)

tile_height ()

tile_width ()

type_get_translation_context (type)

type_get_translation_domain (type)

type_set_translation_context (type, context)

type_set_translation_domain (type, domain)

units_to_pixels (value, unit, resolution)

units_to_points (value, unit, resolution)

user_time ()

utf8_strtrim (str, max_chars)

value_dup_double_array (value)

value_dup_int32_array (value)

value_get_double_array (value)

value_get_int32_array (value)

value_set_double_array (value, data)

value_set_int32_array (value, data)

value_set_static_double_array (value, data)

value_set_static_int32_array (value, data)

value_take_double_array (value, data)

value_take_int32_array (value, data)

vector2_add (vector1, vector2)

vector2_sub (vector1, vector2)

vector3_add (vector1, vector2)

vector3_sub (vector1, vector2)

vector_2d_to_3d (sx, sy, w, h, x, y, vp, p)

vector_2d_to_3d_val (sx, sy, w, h, x, y, vp, p)

vector_3d_to_2d (sx, sy, w, h, vp, p)

version ()

wm_class ()

Details

Gimp.adaptive_supersample_area(x1, y1, x2, y2, max_depth, threshold, render_func, render_data, put_pixel_func, put_pixel_data, progress_func, *progress_data)
Parameters:
  • x1 (int) – left x coordinate of the area to process.

  • y1 (int) – top y coordinate of the area to process.

  • x2 (int) – right x coordinate of the area to process.

  • y2 (int) – bottom y coordinate of the area to process.

  • max_depth (int) – maximum depth of supersampling.

  • threshold (float) – lower threshold of pixel difference that stops supersampling.

  • render_func (Gimp.RenderFunc) – function calculate the color value at given coordinates.

  • render_data (object or None) – user data passed to render_func.

  • put_pixel_func (Gimp.PutPixelFunc) – function to a pixels to a color at given coordinates.

  • put_pixel_data (object or None) – user data passed to put_pixel_func.

  • progress_func (Gimp.ProgressFunc) – function to report progress.

  • progress_data (object or None) – user data passed to progress_func.

Returns:

the number of pixels processed.

Return type:

int

Gimp.airbrush(drawable, pressure, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • pressure (float) – The pressure of the airbrush strokes.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Paint in the current brush with varying pressure. Paint application is time-dependent.

This tool simulates the use of an airbrush. Paint pressure represents the relative intensity of the paint application. High pressure results in a thicker layer of paint while low pressure results in a thinner layer.

Gimp.airbrush_default(drawable, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Paint in the current brush with varying pressure. Paint application is time-dependent.

This tool simulates the use of an airbrush. It is similar to Gimp.airbrush() except that the pressure is derived from the airbrush tools options box. It the option has not been set the default for the option will be used.

Gimp.attach_parasite(parasite)
Parameters:

parasite (Gimp.Parasite) – The parasite to attach.

Returns:

True on success.

Return type:

bool

Add a global parasite.

This procedure attaches a global parasite. It has no return values.

New in version 2.8.

Gimp.babl_format_get_type()
Return type:

GObject.GType

Gimp.bilinear(x, y, values)
Parameters:
Return type:

float

Gimp.bilinear_16(x, y, values)
Parameters:
Return type:

int

Gimp.bilinear_32(x, y, values)
Parameters:
Return type:

int

Gimp.bilinear_8(x, y, values)
Parameters:
Return type:

int

Gimp.bilinear_rgb(x, y, values, has_alpha, retvalues)
Parameters:
  • x (float) –

  • y (float) –

  • values ([float]) – Array of pixels in RGBA double format

  • has_alpha (bool) – Whether values has an alpha channel

  • retvalues ([float]) – Resulting pixel

Gimp.bind_text_domain(domain_name, dir_name)
Parameters:
  • domain_name (str) – a gettext domain name

  • dir_name (str) – path of the catalog directory

This function wraps bindtextdomain on UNIX and wbintextdomain on Windows. dir_name is expected to be in the encoding used by the C library on UNIX and UTF-8 on Windows.

New in version 3.0.

Gimp.brushes_close_popup(brush_callback)
Parameters:

brush_callback (str) – The name of the callback registered for this pop-up.

Returns:

True on success.

Return type:

bool

Close the brush selection dialog.

Closes an open brush selection dialog.

Gimp.brushes_get_list(filter)
Parameters:

filter (str) – An optional regular expression used to filter the list.

Returns:

The list of brushes. The returned value must be freed with GLib.free().

Return type:

[Gimp.Brush]

Retrieve a complete listing of the available brushes.

This procedure returns a complete listing of available GIMP brushes. Each brush returned can be used as input to [func`Gimp`.context_set_brush].

Gimp.brushes_popup(brush_callback, popup_title, initial_brush, parent_window)
Parameters:
  • brush_callback (str) – The callback PDB proc to call when user chooses a brush.

  • popup_title (str) – Title of the brush selection dialog.

  • initial_brush (Gimp.Brush or None) – The brush to set as the initial choice.

  • parent_window (GLib.Bytes or None) – An optional parent window handle for the popup to be set transient to.

Returns:

True on success.

Return type:

bool

Invokes the GIMP brush selection dialog.

Opens a dialog letting a user choose a brush.

Gimp.brushes_refresh()
Returns:

True on success.

Return type:

bool

Refresh current brushes. This function always succeeds.

This procedure retrieves all brushes currently in the user’s brush path and updates the brush dialogs accordingly.

Gimp.brushes_set_popup(brush_callback, brush)
Parameters:
  • brush_callback (str) – The name of the callback registered for this pop-up.

  • brush (Gimp.Brush) – The brush to set as selected.

Returns:

True on success.

Return type:

bool

Sets the selected brush in a brush selection dialog.

Sets the selected brush in a brush selection dialog.

Gimp.buffer_delete(buffer_name)
Parameters:

buffer_name (str) – The buffer name.

Returns:

True on success.

Return type:

bool

Deletes a named buffer.

This procedure deletes a named buffer.

New in version 2.4.

Gimp.buffer_get_bytes(buffer_name)
Parameters:

buffer_name (str) – The buffer name.

Returns:

The buffer bpp.

Return type:

int

Retrieves the specified buffer’s bytes.

This procedure retrieves the specified named buffer’s bytes.

New in version 2.4.

Gimp.buffer_get_height(buffer_name)
Parameters:

buffer_name (str) – The buffer name.

Returns:

The buffer height.

Return type:

int

Retrieves the specified buffer’s height.

This procedure retrieves the specified named buffer’s height.

New in version 2.4.

Gimp.buffer_get_image_type(buffer_name)
Parameters:

buffer_name (str) – The buffer name.

Returns:

The buffer image type.

Return type:

Gimp.ImageType

Retrieves the specified buffer’s image type.

This procedure retrieves the specified named buffer’s image type.

New in version 2.4.

Gimp.buffer_get_width(buffer_name)
Parameters:

buffer_name (str) – The buffer name.

Returns:

The buffer width.

Return type:

int

Retrieves the specified buffer’s width.

This procedure retrieves the specified named buffer’s width.

New in version 2.4.

Gimp.buffer_rename(buffer_name, new_name)
Parameters:
  • buffer_name (str) – The buffer name.

  • new_name (str) – The buffer’s new name.

Returns:

The real name given to the buffer. The returned value must be freed with GLib.free().

Return type:

str

Renames a named buffer.

This procedure renames a named buffer.

New in version 2.4.

Gimp.buffers_get_name_list(filter)
Parameters:

filter (str or None) – An optional regular expression used to filter the list.

Returns:

The list of buffer names. The returned value must be freed with GLib.strfreev().

Return type:

[str]

Retrieve a complete listing of the available buffers.

This procedure returns a complete listing of available named buffers.

New in version 2.4.

Gimp.cache_directory()
Returns:

The default top directory for GIMP cached files.

Return type:

str

Returns the default top directory for GIMP cached files. If the environment variable GIMP3_CACHEDIR exists, that is used. It should be an absolute pathname. Otherwise, a subdirectory of the directory returned by GLib.get_user_cache_dir() is used.

Note that the actual directories used for GIMP caches files can be overridden by the user in the preferences dialog.

In config files such as gimprc, the string ${gimp_cache_dir} expands to this directory.

The returned string is owned by GIMP and must not be modified or freed. The returned string is in the encoding used for filenames by GLib, which isn’t necessarily UTF-8. (On Windows it always is UTF-8.).

New in version 2.10.10.

Gimp.cairo_checkerboard_create(cr, size, light, dark)
Parameters:
Returns:

a new Cairo pattern that can be used as a source on cr.

Return type:

cairo.Pattern

Create a repeating checkerboard pattern.

New in version 2.6.

Gimp.cairo_surface_create_buffer(surface, format)
Parameters:
Returns:

a Gegl.Buffer

Return type:

Gegl.Buffer

This function returns a Gegl.Buffer which wraps surface's pixels. It must only be called on image surfaces, calling it on other surface types is an error.

If format is set, the returned [class`Gegl`.Buffer] will use it. It has to map with surface Cairo format. If unset, the buffer format will be determined from surface. The main difference is that automatically determined format has sRGB space and TRC by default.

New in version 2.10.

Gimp.cairo_surface_get_format(surface)
Parameters:

surface (cairo.Surface) – a Cairo surface

Returns:

the Babl.Object format of surface.

Return type:

Babl.Object

This function returns a Babl.Object format that corresponds to surface's pixel format.

New in version 2.10.

Gimp.canonicalize_identifier(identifier)
Parameters:

identifier (str) – The identifier string to canonicalize.

Returns:

The canonicalized identifier. This is a newly allocated string that should be freed with GLib.free() when no longer needed.

Return type:

str

Turns any input string into a canonicalized string.

Canonical identifiers are e.g. expected by the PDB for procedure and parameter names. Every character of the input string that is not either ‘-’, ‘a-z’, ‘A-Z’ or ‘0-9’ will be replaced by a ‘-‘.

New in version 2.4.

Gimp.check_custom_color1()
Returns:

the _check_custom_color1 value

Return type:

Gegl.Color

Returns the first checkerboard custom color that can be used in previews.

This is a constant value given at plug-in configuration time.

New in version 3.0.

Gimp.check_custom_color2()
Returns:

the _check_custom_color2 value

Return type:

Gegl.Color

Returns the second checkerboard custom color that can be used in previews.

This is a constant value given at plug-in configuration time.

New in version 3.0.

Gimp.check_size()
Returns:

the check_size value

Return type:

Gimp.CheckSize

Returns the size of the checkerboard to be used in previews.

This is a constant value given at plug-in configuration time.

New in version 2.2.

Gimp.check_type()
Returns:

the check_type value

Return type:

Gimp.CheckType

Returns the type of the checkerboard to be used in previews.

This is a constant value given at plug-in configuration time.

New in version 2.2.

Gimp.checks_get_colors(type, color1, color2)
Parameters:
  • type (Gimp.CheckType) – the checkerboard type

  • color1 (Gegl.Color) – current custom color and return location for the first color.

  • color2 (Gegl.Color) – current custom color and return location for the second color.

Returns:

color1:

current custom color and return location for the first color.

color2:

current custom color and return location for the second color.

Return type:

(color1: Gegl.Color, color2: Gegl.Color)

Retrieves the colors to use when drawing a checkerboard for a certain Gimp.CheckType and custom colors. If type is Gimp.CheckType.CUSTOM_CHECKS, then color1 and color2 will remain untouched, which means you must initialize them to the values expected for custom checks.

To obtain the user-set colors in Preferences, just call:

GeglColor *color1 = gimp_check_custom_color1 ();
GeglColor *color2 = gimp_check_custom_color2 ();
gimp_checks_get_colors (gimp_check_type (), &color1, &color2);

New in version 3.0.

Gimp.clone(drawable, src_drawable, clone_type, src_x, src_y, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • src_drawable (Gimp.Drawable) – The source drawable.

  • clone_type (Gimp.CloneType) – The type of clone.

  • src_x (float) – The x coordinate in the source image.

  • src_y (float) – The y coordinate in the source image.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Clone from the source to the dest drawable using the current brush

This tool clones (copies) from the source drawable starting at the specified source coordinates to the dest drawable. If the \”clone_type\” argument is set to PATTERN-CLONE, then the current pattern is used as the source and the \”src_drawable\” argument is ignored. Pattern cloning assumes a tileable pattern and mods the sum of the src coordinates and subsequent stroke offsets with the width and height of the pattern. For image cloning, if the sum of the src coordinates and subsequent stroke offsets exceeds the extents of the src drawable, then no paint is transferred. The clone tool is capable of transforming between any image types including RGB->Indexed–although converting from any type to indexed is significantly slower.

Gimp.clone_default(drawable, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Clone from the source to the dest drawable using the current brush

This tool clones (copies) from the source drawable starting at the specified source coordinates to the dest drawable. This function performs exactly the same as the Gimp.clone() function except that the tools arguments are obtained from the clones option dialog. It this dialog has not been activated then the dialogs default values will be used.

Gimp.color_array_copy(array)
Parameters:

array (Gegl.Color) – an array of colors.

Returns:

a new #GimpColorArray.

Return type:

Gegl.Color

Creates a new #GimpColorArray containing a deep copy of a None-terminated array of [class`Gegl`.Color].

Gimp.color_array_free(array)
Parameters:

array (Gegl.Color) – an array of colors.

Frees a None-terminated array of [class`Gegl`.Color].

Gimp.color_array_get_length(array)
Parameters:

array (Gegl.Color) – an array of colors.

Returns:

the number of [class`Gegl`.Color] in array.

Return type:

int

Gimp.color_array_get_type()
Return type:

GObject.GType

Gimp.color_is_out_of_gamut(color, space)
Parameters:
  • color (Gegl.Color) – a [class`Gegl`.Color]

  • space (Babl.Object) – a color space to convert color to.

Returns:

whether the color is out of space gamut.

Return type:

bool

Determine whether color is out of its space gamut. A small error of margin is accepted, so that for instance a component at -0.0000001 is not making the whole color to be considered as out-of-gamut while it may just be computation imprecision.

New in version 3.0.

Gimp.color_is_out_of_self_gamut(color)
Parameters:

color (Gegl.Color) – a [class`Gegl`.Color]

Returns:

whether the color is out of its own color space gamut.

Return type:

bool

Determine whether color is out of its own space gamut. This can only happen if the color space is unbounded and any of the color component is out of the [0; 1] range. A small error of margin is accepted, so that for instance a component at -0.0000001 is not making the whole color to be considered as out-of-gamut while it may just be computation imprecision.

New in version 3.0.

Gimp.color_is_perceptually_identical(color1, color2)
Parameters:
Returns:

whether the 2 colors can be considered the same for the human eyes.

Return type:

bool

Determine whether color1 and color2 can be considered identical to the human eyes, by computing the distance in a color space as perceptually uniform as possible.

This function will also consider any transparency channel, so that if you only want to compare the pure color, you could for instance set both color’s alpha channel to 1.0 first (possibly on duplicates of the colors if originals should not be modified), such as:

``C gimp_color_set_alpha (color1, 1.0); gimp_color_set_alpha (color2, 1.0); if (gimp_color_is_perceptually_identical (color1, color2))

{

printf (“Both colors are identical, ignoring their alpha component”);

}

``

New in version 3.0.

Gimp.color_list_names()
Returns:

an array of color names.

colors:

return location for an array of [class`Gegl`.Color]

Return type:

([str], colors: [Gegl.Color])

Returns the list of SVG 1.0 color keywords that is recognized by [func`color_parse_name`].

The returned strings are const and must not be freed. Only the array must be freed with g_free().

The optional colors arrays must be freed with [func`color_array_free`] when they are no longer needed.

New in version 2.2.

Gimp.color_parse_css(css)
Parameters:

css (str) – a string describing a color in CSS notation

Returns:

a newly allocated [class`Gegl`.Color] if css was parsed successfully, None otherwise

Return type:

Gegl.Color

Attempts to parse a string describing an sRGB color in CSS notation. This can be either a numerical representation (rgb(255,0,0) or rgb(100%,0%,0%)) or a hexadecimal notation as parsed by [func`color_parse_hex`] (##ff0000) or a color name as parsed by [func`color_parse_css`] (red).

Additionally the rgba(), hsl() and hsla() functions are supported too.

Gimp.color_parse_hex(hex)
Parameters:

hex (str) – a string describing a color in hexadecimal notation

Returns:

a newly allocated color representing hex.

Return type:

Gegl.Color

Attempts to parse a string describing a sRGB color in hexadecimal notation (optionally prefixed with a ‘#’).

Gimp.color_parse_name(name)
Parameters:

name (str) – a color name (in UTF-8 encoding)

Returns:

a sRGB color as defined in “4.4. Recognized color keyword names” list of SVG 1.1 specification, if name was parsed successfully, None otherwise

Return type:

Gegl.Color

Attempts to parse a color name. This function accepts SVG 1.1 color keywords.

Gimp.color_set_alpha(color, alpha)
Parameters:
  • color (Gegl.Color) – a [class`Gegl`.Color]

  • alpha (float) – new value for the alpha channel.

Update the alpha channel, and any other component if necessary (e.g. in case of premultiplied channels), without changing the format of color.

If color has no alpha component, this function is a no-op.

New in version 3.0.

Gimp.config_build_data_path(name)
Parameters:

name (str) – directory name (in UTF-8 encoding)

Returns:

a newly allocated string

Return type:

str

Creates a search path as it is used in the gimprc file. The path returned by Gimp.ConfigInterface.build_data_path() includes a directory below the user’s gimp directory and one in the system-wide data directory.

Note that you cannot use this path directly with Gimp.Path.parse(). As it is in the gimprc notation, you first need to expand and recode it using Gimp.ConfigPath.expand().

New in version 2.4.

Gimp.config_build_plug_in_path(name)
Parameters:

name (str) – directory name (in UTF-8 encoding)

Returns:

a newly allocated string

Return type:

str

Creates a search path as it is used in the gimprc file. The path returned by Gimp.ConfigInterface.build_plug_in_path() includes a directory below the user’s gimp directory and one in the system-wide plug-in directory.

Note that you cannot use this path directly with Gimp.Path.parse(). As it is in the gimprc notation, you first need to expand and recode it using Gimp.ConfigPath.expand().

New in version 2.4.

Gimp.config_build_system_path(name)
Parameters:

name (str) – directory name (in UTF-8 encoding)

Returns:

a newly allocated string

Return type:

str

Creates a search path as it is used in the gimprc file. The path returned by Gimp.ConfigInterface.build_system_path() is just the read-only parts of the search path constructed by Gimp.ConfigInterface.build_plug_in_path().

Note that you cannot use this path directly with Gimp.Path.parse(). As it is in the gimprc notation, you first need to expand and recode it using Gimp.ConfigPath.expand().

New in version 2.10.6.

Gimp.config_build_writable_path(name)
Parameters:

name (str) – directory name (in UTF-8 encoding)

Returns:

a newly allocated string

Return type:

str

Creates a search path as it is used in the gimprc file. The path returned by Gimp.ConfigInterface.build_writable_path() is just the writable parts of the search path constructed by Gimp.ConfigInterface.build_data_path().

Note that you cannot use this path directly with Gimp.Path.parse(). As it is in the gimprc notation, you first need to expand and recode it using Gimp.ConfigPath.expand().

New in version 2.4.

Gimp.config_deserialize_return(scanner, expected_token, nest_level)
Parameters:
Return type:

bool

New in version 2.4.

Gimp.config_diff(a, b, flags)
Parameters:
Returns:

a GLib.List of differing GParamSpecs.

Return type:

[GObject.ParamSpec]

Compares all properties of a and b that have all flags set. If flags is 0, all properties are compared.

If the two objects are not of the same type, only properties that exist in both object classes and are of the same value_type are compared.

New in version 2.4.

Gimp.config_error_quark()
Returns:

the #GQuark that defines the Gimp.Config error domain.

Return type:

int

This function is never called directly. Use GIMP_CONFIG_ERROR() instead.

New in version 2.4.

Gimp.config_param_spec_duplicate(pspec)
Parameters:

pspec (GObject.ParamSpec) – the GObject.ParamSpec to duplicate

Returns:

The new GObject.ParamSpec, or None.

Return type:

GObject.ParamSpec

Creates an exact copy of pspec, with all its properties, returns None if pspec is of an unknown type that can’t be duplicated.

New in version 3.0.

Gimp.config_reset_properties(object)
Parameters:

object (GObject.Object) – a GObject.Object

Resets all writable properties of object to the default values as defined in their GObject.ParamSpec. Properties marked as “construct-only” are not touched.

If you want to reset a Gimp.Config object, please use Gimp.Config.reset().

New in version 2.4.

Gimp.config_reset_property(object, property_name)
Parameters:

Resets the property named property_name to its default value. The property must be writable and must not be marked as “construct-only”.

New in version 2.4.

Gimp.config_serialize_value(value, str, escaped)
Parameters:
Returns:

True if serialization succeeded, False otherwise.

Return type:

bool

This utility function appends a string representation of GObject.Value to str.

New in version 2.4.

Gimp.config_string_append_escaped(string, val)
Parameters:

Escapes and quotes val and appends it to string. The escape algorithm is different from the one used by GLib.strescape() since it leaves non-ASCII characters intact and thus preserves UTF-8 strings. Only control characters and quotes are being escaped.

New in version 2.4.

Gimp.config_sync(src, dest, flags)
Parameters:
Returns:

True if dest was modified, False otherwise

Return type:

bool

Compares all read- and write-able properties from src and dest that have all flags set. Differing values are then copied from src to dest. If flags is 0, all differing read/write properties.

Properties marked as “construct-only” are not touched.

If the two objects are not of the same type, only properties that exist in both object classes and are of the same value_type are synchronized

New in version 2.4.

Gimp.config_type_register(parent_type, type_name, pspecs)
Parameters:
Returns:

the newly registered GObject.GType

Return type:

GObject.GType

This function is a fancy wrapper around GObject.type_register_static(). It creates a new object type as subclass of parent_type, installs pspecs on it and makes the new type implement the Gimp.Config interface.

New in version 3.0.

Gimp.context_are_dynamics_enabled()
Returns:

Whether dynamics enabled or disabled.

Return type:

bool

Whether the currently active paint dynamics will be applied to painting.

Returns whether the currently active paint dynamics (as returned by gimp_context_get_dynamics()) is enabled.

New in version 3.0.

Gimp.context_enable_dynamics(enable)
Parameters:

enable (bool) – Whether to enable or disable dynamics.

Returns:

True on success.

Return type:

bool

Enables paint dynamics using the active paint dynamics.

Enables the active paint dynamics to be used in all subsequent paint operations.

New in version 3.0.

Gimp.context_get_antialias()
Returns:

The antialias setting.

Return type:

bool

Get the antialias setting.

Returns the antialias setting.

New in version 2.8.

Gimp.context_get_background()
Returns:

The background color.

Return type:

Gegl.Color

Get the current GIMP background color.

Returns the current GIMP background color. The background color is used in a variety of tools such as blending, erasing (with non-alpha images), and image filling.

New in version 2.2.

Gimp.context_get_brush()
Returns:

The active brush.

Return type:

Gimp.Brush

Get the currently active brush.

Returns the currently active brush. All paint and stroke operations use this brush.

New in version 2.2.

Gimp.context_get_brush_angle()
Returns:

Angle in degrees.

Return type:

float

Get brush angle in degrees.

Set the angle in degrees for brush based paint tools.

New in version 2.8.

Gimp.context_get_brush_aspect_ratio()
Returns:

Aspect ratio.

Return type:

float

Get brush aspect ratio.

Set the aspect ratio for brush based paint tools.

New in version 2.8.

Gimp.context_get_brush_force()
Returns:

Brush application force.

Return type:

float

Get brush force in paint options.

Get the brush application force for brush based paint tools.

New in version 2.10.

Gimp.context_get_brush_hardness()
Returns:

Brush hardness.

Return type:

float

Get brush hardness in paint options.

Get the brush hardness for brush based paint tools.

New in version 2.10.

Gimp.context_get_brush_size()
Returns:

Brush size in pixels.

Return type:

float

Get brush size in pixels.

Get the brush size in pixels for brush based paint tools.

New in version 2.8.

Gimp.context_get_brush_spacing()
Returns:

Brush spacing as fraction of size.

Return type:

float

Get brush spacing as percent of size.

Get the brush spacing as percent of size for brush based paint tools.

New in version 2.10.

Gimp.context_get_diagonal_neighbors()
Returns:

The diagonal neighbors setting.

Return type:

bool

Get the diagonal neighbors setting.

Returns the diagonal neighbors setting.

New in version 2.10.

Gimp.context_get_distance_metric()
Returns:

The distance metric.

Return type:

Gegl.DistanceMetric

Get the distance metric used in some computations.

Returns the distance metric in the current context. See Gimp.context_set_distance_metric() to know more about its usage.

New in version 2.10.

Gimp.context_get_dynamics_name()
Returns:

The name of the active paint dynamics. The returned value must be freed with GLib.free().

Return type:

str

Get the currently active paint dynamics.

Returns the name of the currently active paint dynamics. If enabled, all paint operations and stroke operations use this paint dynamics to control the application of paint to the image. If disabled, the dynamics will be ignored during paint actions. See Gimp.context_are_dynamics_enabled() to enquire whether dynamics are used or ignored.

New in version 2.8.

Gimp.context_get_emulate_brush_dynamics()
Returns:

The emulate brush dynamics setting.

Return type:

bool

Retrieve the currently active stroke option’s emulate brush dynamics setting.

This procedure returns the emulate brush dynamics property of the currently active stroke options.

New in version 3.0.

Gimp.context_get_feather()
Returns:

The feather setting.

Return type:

bool

Get the feather setting.

Returns the feather setting.

New in version 2.8.

Gimp.context_get_feather_radius()
Returns:

True on success.

feather_radius_x:

The horizontal feather radius.

feather_radius_y:

The vertical feather radius.

Return type:

(bool, feather_radius_x: float, feather_radius_y: float)

Get the feather radius setting.

Returns the feather radius setting.

New in version 2.8.

Gimp.context_get_font()
Returns:

The active font.

Return type:

Gimp.Font

Get the currently active font.

Returns the currently active font.

New in version 2.2.

Gimp.context_get_foreground()
Returns:

The foreground color.

Return type:

Gegl.Color

Get the current GIMP foreground color.

Returns the current GIMP foreground color. The foreground color is used in a variety of tools such as paint tools, blending, and bucket fill.

New in version 2.2.

Gimp.context_get_gradient()
Returns:

The active gradient.

Return type:

Gimp.Gradient

Get the currently active gradient.

Returns the currently active gradient.

New in version 2.2.

Gimp.context_get_gradient_blend_color_space()
Returns:

Color blend space.

Return type:

Gimp.GradientBlendColorSpace

Get the gradient blend color space.

Get the gradient blend color space for paint tools and the gradient tool.

New in version 2.10.

Gimp.context_get_gradient_repeat_mode()
Returns:

Repeat mode.

Return type:

Gimp.RepeatMode

Get the gradient repeat mode.

Get the gradient repeat mode for paint tools and the gradient tool.

New in version 2.10.

Gimp.context_get_gradient_reverse()
Returns:

Reverse.

Return type:

bool

Get the gradient reverse setting.

Get the gradient reverse setting for paint tools and the gradient tool.

New in version 2.10.

Gimp.context_get_ink_angle()
Returns:

ink angle in degrees.

Return type:

float

Get ink angle in degrees.

Get the ink angle in degrees for ink tool.

New in version 2.8.

Gimp.context_get_ink_blob_angle()
Returns:

ink blob angle in degrees.

Return type:

float

Get ink blob angle in degrees.

Get the ink blob angle in degrees for ink tool.

New in version 2.8.

Gimp.context_get_ink_blob_aspect_ratio()
Returns:

ink blob aspect ratio.

Return type:

float

Get ink blob aspect ratio.

Get the ink blob aspect ratio for ink tool.

New in version 2.8.

Gimp.context_get_ink_blob_type()
Returns:

Ink blob type.

Return type:

Gimp.InkBlobType

Get ink blob type.

Get the ink blob type for ink tool.

New in version 2.8.

Gimp.context_get_ink_size()
Returns:

ink blob size in pixels.

Return type:

float

Get ink blob size in pixels.

Get the ink blob size in pixels for ink tool.

New in version 2.8.

Gimp.context_get_ink_size_sensitivity()
Returns:

ink size sensitivity.

Return type:

float

Get ink size sensitivity.

Get the ink size sensitivity for ink tool.

New in version 2.8.

Gimp.context_get_ink_speed_sensitivity()
Returns:

ink speed sensitivity.

Return type:

float

Get ink speed sensitivity.

Get the ink speed sensitivity for ink tool.

New in version 2.8.

Gimp.context_get_ink_tilt_sensitivity()
Returns:

ink tilt sensitivity.

Return type:

float

Get ink tilt sensitivity.

Get the ink tilt sensitivity for ink tool.

New in version 2.8.

Gimp.context_get_interpolation()
Returns:

The interpolation type.

Return type:

Gimp.InterpolationType

Get the interpolation type.

Returns the interpolation setting. The return value is an integer which corresponds to the values listed in the argument description. If the interpolation has not been set explicitly by Gimp.context_set_interpolation(), the default interpolation set in gimprc will be used.

New in version 2.8.

Gimp.context_get_line_cap_style()
Returns:

The line cap style setting.

Return type:

Gimp.CapStyle

Get the line cap style setting.

Returns the line cap style setting.

New in version 2.10.

Gimp.context_get_line_dash_offset()
Returns:

The line dash offset setting.

Return type:

float

Get the line dash offset setting.

Returns the line dash offset setting.

New in version 2.10.

Gimp.context_get_line_dash_pattern()
Returns:

True on success.

dashes:

The line dash pattern setting.

Return type:

(bool, dashes: [float])

Get the line dash pattern setting.

Returns the line dash pattern setting.

New in version 2.10.

Gimp.context_get_line_join_style()
Returns:

The line join style setting.

Return type:

Gimp.JoinStyle

Get the line join style setting.

Returns the line join style setting.

New in version 2.10.

Gimp.context_get_line_miter_limit()
Returns:

The line miter limit setting.

Return type:

float

Get the line miter limit setting.

Returns the line miter limit setting.

New in version 2.10.

Gimp.context_get_line_width()
Returns:

The line width setting.

Return type:

float

Get the line width setting.

Returns the line width setting.

New in version 2.10.

Gimp.context_get_line_width_unit()
Returns:

The line width unit setting.

Return type:

Gimp.Unit

Get the line width unit setting.

Returns the line width unit setting.

New in version 2.10.

Gimp.context_get_mypaint_brush()
Returns:

The name of the active MyPaint brush. The returned value must be freed with GLib.free().

Return type:

str

Get the currently active MyPaint brush.

Returns the name of the currently active MyPaint brush.

New in version 2.10.

Gimp.context_get_opacity()
Returns:

The opacity.

Return type:

float

Get the opacity.

Returns the opacity setting. The return value is a floating point number between 0 and 100.

New in version 2.2.

Gimp.context_get_paint_method()
Returns:

The name of the active paint method. The returned value must be freed with GLib.free().

Return type:

str

Get the currently active paint method.

Returns the name of the currently active paint method.

New in version 2.4.

Gimp.context_get_paint_mode()
Returns:

The paint mode.

Return type:

Gimp.LayerMode

Get the paint mode.

Returns the paint-mode setting. The return value is an integer which corresponds to the values listed in the argument description.

New in version 2.2.

Gimp.context_get_palette()
Returns:

The active palette.

Return type:

Gimp.Palette

Get the currently active palette.

Returns the currently active palette.

New in version 2.2.

Gimp.context_get_pattern()
Returns:

The active pattern.

Return type:

Gimp.Pattern

Get the currently active pattern.

Returns the active pattern in the current context. All clone and bucket-fill operations with patterns will use this pattern to control the application of paint to the image.

New in version 2.2.

Gimp.context_get_sample_criterion()
Returns:

The sample criterion setting.

Return type:

Gimp.SelectCriterion

Get the sample criterion setting.

Returns the sample criterion setting.

New in version 2.8.

Gimp.context_get_sample_merged()
Returns:

The sample merged setting.

Return type:

bool

Get the sample merged setting.

Returns the sample merged setting.

New in version 2.8.

Gimp.context_get_sample_threshold()
Returns:

The sample threshold setting.

Return type:

float

Get the sample threshold setting.

Returns the sample threshold setting.

New in version 2.8.

Gimp.context_get_sample_threshold_int()
Returns:

The sample threshold setting.

Return type:

int

Get the sample threshold setting as an integer value.

Returns the sample threshold setting as an integer value. See Gimp.context_get_sample_threshold().

New in version 2.8.

Gimp.context_get_sample_transparent()
Returns:

The sample transparent setting.

Return type:

bool

Get the sample transparent setting.

Returns the sample transparent setting.

New in version 2.8.

Gimp.context_get_stroke_method()
Returns:

The active stroke method.

Return type:

Gimp.StrokeMethod

Get the currently active stroke method.

Returns the currently active stroke method.

New in version 2.10.

Gimp.context_get_transform_direction()
Returns:

The transform direction.

Return type:

Gimp.TransformDirection

Get the transform direction.

Returns the transform direction. The return value is an integer which corresponds to the values listed in the argument description.

New in version 2.8.

Gimp.context_get_transform_resize()
Returns:

The transform resize type.

Return type:

Gimp.TransformResize

Get the transform resize type.

Returns the transform resize setting. The return value is an integer which corresponds to the values listed in the argument description.

New in version 2.8.

Gimp.context_list_paint_methods()
Returns:

True on success.

paint_methods:

The names of the available paint methods.

Return type:

(bool, paint_methods: [str])

Lists the available paint methods.

Lists the names of the available paint methods. Any of the names can be used for Gimp.context_set_paint_method().

New in version 2.4.

Gimp.context_pop()
Returns:

True on success.

Return type:

bool

Pops the topmost context from the plug-in’s context stack.

Removes the topmost context from the plug-in’s context stack. The next context on the stack becomes the new current context of the plug-in, that is, the context that was active before the corresponding call to Gimp.context_push()

New in version 2.2.

Gimp.context_push()
Returns:

True on success.

Return type:

bool

Pushes a context onto the top of the plug-in’s context stack.

Creates a new context by copying the current context. The copy becomes the new current context for the calling plug-in until it is popped again using Gimp.context_pop().

New in version 2.2.

Gimp.context_set_antialias(antialias)
Parameters:

antialias (bool) – The antialias setting.

Returns:

True on success.

Return type:

bool

Set the antialias setting.

Modifies the antialias setting. If antialiasing is turned on, the edges of selected region will contain intermediate values which give the appearance of a sharper, less pixelized edge. This should be set as True most of the time unless a binary-only selection is wanted.

This setting affects the following procedures: Gimp.Image.select_color(), Gimp.Image.select_contiguous_color(), Gimp.Image.select_round_rectangle(), Gimp.Image.select_ellipse(), Gimp.Image.select_polygon(), Gimp.Image.select_item(), Gimp.Drawable.edit_bucket_fill(), Gimp.Drawable.edit_stroke_item(), Gimp.Drawable.edit_stroke_selection().

New in version 2.8.

Gimp.context_set_background(background)
Parameters:

background (Gegl.Color) – The background color.

Returns:

True on success.

Return type:

bool

Set the current GIMP background color.

Sets the current GIMP background color. After this is set, operations which use background such as blending, filling images, clearing, and erasing (in non-alpha images) will use the new value.

New in version 2.2.

Gimp.context_set_brush(brush)
Parameters:

brush (Gimp.Brush) – The brush.

Returns:

True on success.

Return type:

bool

Set the active brush.

Sets the active brush in the current context. The brush will be used in subsequent paint and stroke operations. Returns an error when the brush data was uninstalled since the brush object was created.

New in version 2.2.

Gimp.context_set_brush_angle(angle)
Parameters:

angle (float) – Angle in degrees.

Returns:

True on success.

Return type:

bool

Set brush angle in degrees.

Set the angle in degrees for brush based paint tools.

New in version 2.8.

Gimp.context_set_brush_aspect_ratio(aspect)
Parameters:

aspect (float) – Aspect ratio.

Returns:

True on success.

Return type:

bool

Set brush aspect ratio.

Set the aspect ratio for brush based paint tools.

New in version 2.8.

Gimp.context_set_brush_default_hardness()
Returns:

True on success.

Return type:

bool

Set brush spacing to its default.

Set the brush spacing to the default for paintbrush, airbrush, or pencil tools.

New in version 2.10.

Gimp.context_set_brush_default_size()
Returns:

True on success.

Return type:

bool

Set brush size to its default.

Set the brush size to the default (max of width and height) for paintbrush, airbrush, or pencil tools.

New in version 2.8.

Gimp.context_set_brush_default_spacing()
Returns:

True on success.

Return type:

bool

Set brush spacing to its default.

Set the brush spacing to the default for paintbrush, airbrush, or pencil tools.

New in version 2.10.

Gimp.context_set_brush_force(force)
Parameters:

force (float) – Brush application force.

Returns:

True on success.

Return type:

bool

Set brush application force.

Set the brush application force for brush based paint tools.

New in version 2.10.

Gimp.context_set_brush_hardness(hardness)
Parameters:

hardness (float) – Brush hardness.

Returns:

True on success.

Return type:

bool

Set brush hardness.

Set the brush hardness for brush based paint tools.

New in version 2.10.

Gimp.context_set_brush_size(size)
Parameters:

size (float) – Brush size in pixels.

Returns:

True on success.

Return type:

bool

Set brush size in pixels.

Set the brush size in pixels for brush based paint tools.

New in version 2.8.

Gimp.context_set_brush_spacing(spacing)
Parameters:

spacing (float) – Brush spacing as fraction of size.

Returns:

True on success.

Return type:

bool

Set brush spacing as percent of size.

Set the brush spacing as percent of size for brush based paint tools.

New in version 2.10.

Gimp.context_set_default_colors()
Returns:

True on success.

Return type:

bool

Set the current GIMP foreground and background colors to black and white.

Sets the current GIMP foreground and background colors to their initial default values, black and white.

New in version 2.2.

Gimp.context_set_defaults()
Returns:

True on success.

Return type:

bool

Reset context settings to their default values.

Resets context settings used by various procedures to their default value. You should usually call this after a context push so that a script which calls procedures affected by context settings will not be affected by changes in the global context.

New in version 2.8.

Gimp.context_set_diagonal_neighbors(diagonal_neighbors)
Parameters:

diagonal_neighbors (bool) – The diagonal neighbors setting.

Returns:

True on success.

Return type:

bool

Set the diagonal neighbors setting.

Modifies the diagonal neighbors setting. If the affected region of an operation is based on a seed point, like when doing a seed fill, then, when this setting is True, all eight neighbors of each pixel are considered when calculating the affected region; in contrast, when this setting is False, only the four orthogonal neighbors of each pixel are considered.

This setting affects the following procedures: Gimp.Image.select_contiguous_color(), Gimp.Drawable.edit_bucket_fill().

New in version 2.10.

Gimp.context_set_distance_metric(metric)
Parameters:

metric (Gegl.DistanceMetric) – The distance metric.

Returns:

True on success.

Return type:

bool

Set the distance metric used in some computations.

Modifies the distance metric used in some computations, such as Gimp.Drawable.edit_gradient_fill(). In particular, it does not change the metric used in generic distance computation on canvas, as in the Measure tool.

This setting affects the following procedures: Gimp.Drawable.edit_gradient_fill().

New in version 2.10.

Gimp.context_set_dynamics_name(name)
Parameters:

name (str) – A name of a paint dynamics.

Returns:

True on success.

Return type:

bool

Set the active paint dynamics.

Sets the active paint dynamics. The paint dynamics will be used in all subsequent paint operations when dynamics are enabled. The name should be a name of an installed paint dynamics. Returns an error if no matching paint dynamics is found.

New in version 2.8.

Gimp.context_set_emulate_brush_dynamics(emulate_dynamics)
Parameters:

emulate_dynamics (bool) – The new emulate brush dynamics setting.

Returns:

True on success.

Return type:

bool

Set the stroke option’s emulate brush dynamics setting.

This procedure sets the specified emulate brush dynamics setting. The new method will be used in all subsequent stroke operations.

New in version 3.0.

Gimp.context_set_feather(feather)
Parameters:

feather (bool) – The feather setting.

Returns:

True on success.

Return type:

bool

Set the feather setting.

Modifies the feather setting. If the feather option is enabled, selections will be blurred before combining. The blur is a gaussian blur; its radii can be controlled using Gimp.context_set_feather_radius().

This setting affects the following procedures: Gimp.Image.select_color(), Gimp.Image.select_contiguous_color(), Gimp.Image.select_rectangle(), Gimp.Image.select_round_rectangle(), Gimp.Image.select_ellipse(), Gimp.Image.select_polygon(), Gimp.Image.select_item().

New in version 2.8.

Gimp.context_set_feather_radius(feather_radius_x, feather_radius_y)
Parameters:
  • feather_radius_x (float) – The horizontal feather radius.

  • feather_radius_y (float) – The vertical feather radius.

Returns:

True on success.

Return type:

bool

Set the feather radius setting.

Modifies the feather radius setting.

This setting affects all procedures that are affected by Gimp.context_set_feather().

New in version 2.8.

Gimp.context_set_font(font)
Parameters:

font (Gimp.Font) – The font.

Returns:

True on success.

Return type:

bool

Set the active font.

Sets the active font in the current context. The font will be used in subsequent text operations. Returns an error when the font data was uninstalled since the font object was created.

New in version 2.2.

Gimp.context_set_foreground(foreground)
Parameters:

foreground (Gegl.Color) – The foreground color.

Returns:

True on success.

Return type:

bool

Set the current GIMP foreground color.

Sets the current GIMP foreground color. After this is set, operations which use foreground such as paint tools, blending, and bucket fill will use the new value.

New in version 2.2.

Gimp.context_set_gradient(gradient)
Parameters:

gradient (Gimp.Gradient) – The gradient.

Returns:

True on success.

Return type:

bool

Sets the active gradient.

Sets the active gradient in the current context. The gradient will be used in subsequent gradient operations. Returns an error when the gradient data was uninstalled since the gradient object was created.

New in version 2.2.

Gimp.context_set_gradient_blend_color_space(blend_color_space)
Parameters:

blend_color_space (Gimp.GradientBlendColorSpace) – Blend color space.

Returns:

True on success.

Return type:

bool

Set the gradient blend color space.

Set the gradient blend color space for paint tools and the gradient tool.

New in version 2.10.

Gimp.context_set_gradient_fg_bg_hsv_ccw()
Returns:

True on success.

Return type:

bool

Sets the built-in FG-BG HSV (ccw) gradient as the active gradient.

Sets the built-in FG-BG HSV (ccw) gradient as the active gradient. The gradient will be used for subsequent gradient operations.

New in version 2.10.

Gimp.context_set_gradient_fg_bg_hsv_cw()
Returns:

True on success.

Return type:

bool

Sets the built-in FG-BG HSV (cw) gradient as the active gradient.

Sets the built-in FG-BG HSV (cw) gradient as the active gradient. The gradient will be used for subsequent gradient operations.

New in version 2.10.

Gimp.context_set_gradient_fg_bg_rgb()
Returns:

True on success.

Return type:

bool

Sets the built-in FG-BG RGB gradient as the active gradient.

Sets the built-in FG-BG RGB gradient as the active gradient. The gradient will be used for subsequent gradient operations.

New in version 2.10.

Gimp.context_set_gradient_fg_transparent()
Returns:

True on success.

Return type:

bool

Sets the built-in FG-Transparent gradient as the active gradient.

Sets the built-in FG-Transparent gradient as the active gradient. The gradient will be used for subsequent gradient operations.

New in version 2.10.

Gimp.context_set_gradient_repeat_mode(repeat_mode)
Parameters:

repeat_mode (Gimp.RepeatMode) – Repeat mode.

Returns:

True on success.

Return type:

bool

Set the gradient repeat mode.

Set the gradient repeat mode for paint tools and the gradient tool.

New in version 2.10.

Gimp.context_set_gradient_reverse(reverse)
Parameters:

reverse (bool) – Reverse.

Returns:

True on success.

Return type:

bool

Set the gradient reverse setting.

Set the gradient reverse setting for paint tools and the gradient tool.

New in version 2.10.

Gimp.context_set_ink_angle(angle)
Parameters:

angle (float) – ink angle in degrees.

Returns:

True on success.

Return type:

bool

Set ink angle in degrees.

Set the ink angle in degrees for ink tool.

New in version 2.8.

Gimp.context_set_ink_blob_angle(angle)
Parameters:

angle (float) – ink blob angle in degrees.

Returns:

True on success.

Return type:

bool

Set ink blob angle in degrees.

Set the ink blob angle in degrees for ink tool.

New in version 2.8.

Gimp.context_set_ink_blob_aspect_ratio(aspect)
Parameters:

aspect (float) – ink blob aspect ratio.

Returns:

True on success.

Return type:

bool

Set ink blob aspect ratio.

Set the ink blob aspect ratio for ink tool.

New in version 2.8.

Gimp.context_set_ink_blob_type(type)
Parameters:

type (Gimp.InkBlobType) – Ink blob type.

Returns:

True on success.

Return type:

bool

Set ink blob type.

Set the ink blob type for ink tool.

New in version 2.8.

Gimp.context_set_ink_size(size)
Parameters:

size (float) – ink blob size in pixels.

Returns:

True on success.

Return type:

bool

Set ink blob size in pixels.

Set the ink blob size in pixels for ink tool.

New in version 2.8.

Gimp.context_set_ink_size_sensitivity(size)
Parameters:

size (float) – ink size sensitivity.

Returns:

True on success.

Return type:

bool

Set ink size sensitivity.

Set the ink size sensitivity for ink tool.

New in version 2.8.

Gimp.context_set_ink_speed_sensitivity(speed)
Parameters:

speed (float) – ink speed sensitivity.

Returns:

True on success.

Return type:

bool

Set ink speed sensitivity.

Set the ink speed sensitivity for ink tool.

New in version 2.8.

Gimp.context_set_ink_tilt_sensitivity(tilt)
Parameters:

tilt (float) – ink tilt sensitivity.

Returns:

True on success.

Return type:

bool

Set ink tilt sensitivity.

Set the ink tilt sensitivity for ink tool.

New in version 2.8.

Gimp.context_set_interpolation(interpolation)
Parameters:

interpolation (Gimp.InterpolationType) – The interpolation type.

Returns:

True on success.

Return type:

bool

Set the interpolation type.

Modifies the interpolation setting.

This setting affects affects the following procedures: Gimp.Item.transform_flip(), Gimp.Item.transform_perspective(), Gimp.Item.transform_rotate(), Gimp.Item.transform_scale(), Gimp.Item.transform_shear(), Gimp.Item.transform_2d(), Gimp.Item.transform_matrix(), Gimp.Image.scale(), Gimp.Layer.scale().

New in version 2.8.

Gimp.context_set_line_cap_style(cap_style)
Parameters:

cap_style (Gimp.CapStyle) – The line cap style setting.

Returns:

True on success.

Return type:

bool

Set the line cap style setting.

Modifies the line cap style setting for stroking lines.

This setting affects the following procedures: Gimp.Drawable.edit_stroke_selection(), Gimp.Drawable.edit_stroke_item().

New in version 2.10.

Gimp.context_set_line_dash_offset(dash_offset)
Parameters:

dash_offset (float) – The line dash offset setting.

Returns:

True on success.

Return type:

bool

Set the line dash offset setting.

Modifies the line dash offset setting for stroking lines.

This setting affects the following procedures: Gimp.Drawable.edit_stroke_selection(), Gimp.Drawable.edit_stroke_item().

New in version 2.10.

Gimp.context_set_line_dash_pattern(dashes)
Parameters:

dashes ([float]) – The line dash pattern setting.

Returns:

True on success.

Return type:

bool

Set the line dash pattern setting.

Modifies the line dash pattern setting for stroking lines.

The unit of the dash pattern segments is the actual line width used for the stroke operation, in other words a segment length of 1.0 results in a square segment shape (or gap shape).

This setting affects the following procedures: Gimp.Drawable.edit_stroke_selection(), Gimp.Drawable.edit_stroke_item().

New in version 2.10.

Gimp.context_set_line_join_style(join_style)
Parameters:

join_style (Gimp.JoinStyle) – The line join style setting.

Returns:

True on success.

Return type:

bool

Set the line join style setting.

Modifies the line join style setting for stroking lines. This setting affects the following procedures: Gimp.Drawable.edit_stroke_selection(), Gimp.Drawable.edit_stroke_item().

New in version 2.10.

Gimp.context_set_line_miter_limit(miter_limit)
Parameters:

miter_limit (float) – The line miter limit setting.

Returns:

True on success.

Return type:

bool

Set the line miter limit setting.

Modifies the line miter limit setting for stroking lines. A mitered join is converted to a bevelled join if the miter would extend to a distance of more than (miter-limit * line-width) from the actual join point.

This setting affects the following procedures: Gimp.Drawable.edit_stroke_selection(), Gimp.Drawable.edit_stroke_item().

New in version 2.10.

Gimp.context_set_line_width(line_width)
Parameters:

line_width (float) – The line width setting.

Returns:

True on success.

Return type:

bool

Set the line width setting.

Modifies the line width setting for stroking lines.

This setting affects the following procedures: Gimp.Drawable.edit_stroke_selection(), Gimp.Drawable.edit_stroke_item().

New in version 2.10.

Gimp.context_set_line_width_unit(line_width_unit)
Parameters:

line_width_unit (Gimp.Unit) – The line width setting unit.

Returns:

True on success.

Return type:

bool

Set the line width unit setting.

Modifies the line width unit setting for stroking lines.

This setting affects the following procedures: Gimp.Drawable.edit_stroke_selection(), Gimp.Drawable.edit_stroke_item().

New in version 2.10.

Gimp.context_set_mypaint_brush(name)
Parameters:

name (str) – A name of a MyPaint brush.

Returns:

True on success.

Return type:

bool

Set a MyPaint brush as the active MyPaint brush.

Sets the active MyPaint brush to the named MyPaint brush. The brush will be used in all subsequent MyPaint paint operations. The name should be a name of an installed MyPaint brush. Returns an error if no matching MyPaint brush is found.

New in version 2.10.

Gimp.context_set_opacity(opacity)
Parameters:

opacity (float) – The opacity.

Returns:

True on success.

Return type:

bool

Set the opacity.

Modifies the opacity setting. The value should be a floating point number between 0 and 100.

New in version 2.2.

Gimp.context_set_paint_method(name)
Parameters:

name (str) – The name of the paint method.

Returns:

True on success.

Return type:

bool

Set the active paint method.

Sets the active paint method to the named paint method. The paint method will be used in all subsequent paint operations. The name should be a name of an available paint method. Returns an error if no matching paint method is found.

New in version 2.4.

Gimp.context_set_paint_mode(paint_mode)
Parameters:

paint_mode (Gimp.LayerMode) – The paint mode.

Returns:

True on success.

Return type:

bool

Set the paint mode.

Modifies the paint_mode setting.

New in version 2.2.

Gimp.context_set_palette(palette)
Parameters:

palette (Gimp.Palette) – The palette.

Returns:

True on success.

Return type:

bool

Set the active palette.

Sets the active palette in the current context. The palette will be used in subsequent paint operations. Returns an error when the palette data was uninstalled since the palette object was created.

New in version 2.2.

Gimp.context_set_pattern(pattern)
Parameters:

pattern (Gimp.Pattern) – The pattern.

Returns:

True on success.

Return type:

bool

Set the active pattern.

Sets the active pattern in the current context. The pattern will be used in subsequent fill operations using a pattern. Returns an error when the pattern data was uninstalled since the pattern object was created.

New in version 2.2.

Gimp.context_set_sample_criterion(sample_criterion)
Parameters:

sample_criterion (Gimp.SelectCriterion) – The sample criterion setting.

Returns:

True on success.

Return type:

bool

Set the sample criterion setting.

Modifies the sample criterion setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls how color similarity is determined. SELECT_CRITERION_COMPOSITE is the default value.

This setting affects the following procedures: Gimp.Image.select_color(), Gimp.Image.select_contiguous_color(), Gimp.Drawable.edit_bucket_fill().

New in version 2.8.

Gimp.context_set_sample_merged(sample_merged)
Parameters:

sample_merged (bool) – The sample merged setting.

Returns:

True on success.

Return type:

bool

Set the sample merged setting.

Modifies the sample merged setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls whether the pixel data from the given drawable is used (‘sample-merged’ is False), or the pixel data from the composite image (‘sample-merged’ is True. This is equivalent to sampling for colors after merging all visible layers).

This setting affects the following procedures: Gimp.Image.select_color(), Gimp.Image.select_contiguous_color(), Gimp.Drawable.edit_bucket_fill().

New in version 2.8.

Gimp.context_set_sample_threshold(sample_threshold)
Parameters:

sample_threshold (float) – The sample threshold setting.

Returns:

True on success.

Return type:

bool

Set the sample threshold setting.

Modifies the sample threshold setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls what is \”sufficiently close\” to be considered a similar color. If the sample threshold has not been set explicitly, the default threshold set in gimprc will be used.

This setting affects the following procedures: Gimp.Image.select_color(), Gimp.Image.select_contiguous_color(), Gimp.Drawable.edit_bucket_fill().

New in version 2.8.

Gimp.context_set_sample_threshold_int(sample_threshold)
Parameters:

sample_threshold (int) – The sample threshold setting.

Returns:

True on success.

Return type:

bool

Set the sample threshold setting as an integer value.

Modifies the sample threshold setting as an integer value. See Gimp.context_set_sample_threshold().

New in version 2.8.

Gimp.context_set_sample_transparent(sample_transparent)
Parameters:

sample_transparent (bool) – The sample transparent setting.

Returns:

True on success.

Return type:

bool

Set the sample transparent setting.

Modifies the sample transparent setting. If an operation depends on the colors of the pixels present in a drawable, like when doing a seed fill, this setting controls whether transparency is considered to be a unique selectable color. When this setting is True, transparent areas can be selected or filled.

This setting affects the following procedures: Gimp.Image.select_color(), Gimp.Image.select_contiguous_color(), Gimp.Drawable.edit_bucket_fill().

New in version 2.8.

Gimp.context_set_stroke_method(stroke_method)
Parameters:

stroke_method (Gimp.StrokeMethod) – The new stroke method.

Returns:

True on success.

Return type:

bool

Set the active stroke method.

Sets the active stroke method. The method will be used in all subsequent stroke operations.

New in version 2.10.

Gimp.context_set_transform_direction(transform_direction)
Parameters:

transform_direction (Gimp.TransformDirection) – The transform direction.

Returns:

True on success.

Return type:

bool

Set the transform direction.

Modifies the transform direction setting.

This setting affects affects the following procedures: Gimp.Item.transform_flip(), Gimp.Item.transform_perspective(), Gimp.Item.transform_rotate(), Gimp.Item.transform_scale(), Gimp.Item.transform_shear(), Gimp.Item.transform_2d(), Gimp.Item.transform_matrix().

New in version 2.8.

Gimp.context_set_transform_resize(transform_resize)
Parameters:

transform_resize (Gimp.TransformResize) – The transform resize type.

Returns:

True on success.

Return type:

bool

Set the transform resize type.

Modifies the transform resize setting. When transforming pixels, if the result of a transform operation has a different size than the original area, this setting determines how the resulting area is sized.

This setting affects affects the following procedures: Gimp.Item.transform_flip(), Gimp.Item.transform_flip_simple(), Gimp.Item.transform_perspective(), Gimp.Item.transform_rotate(), Gimp.Item.transform_rotate_simple(), Gimp.Item.transform_scale(), Gimp.Item.transform_shear(), Gimp.Item.transform_2d(), Gimp.Item.transform_matrix().

New in version 2.8.

Gimp.context_swap_colors()
Returns:

True on success.

Return type:

bool

Swap the current GIMP foreground and background colors.

Swaps the current GIMP foreground and background colors, so that the new foreground color becomes the old background color and vice versa.

New in version 2.2.

Gimp.convolve(drawable, pressure, convolve_type, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • pressure (float) – The pressure.

  • convolve_type (Gimp.ConvolveType) – Convolve type.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Convolve (Blur, Sharpen) using the current brush.

This tool convolves the specified drawable with either a sharpening or blurring kernel. The pressure parameter controls the magnitude of the operation. Like the paintbrush, this tool linearly interpolates between the specified stroke coordinates.

Gimp.convolve_default(drawable, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Convolve (Blur, Sharpen) using the current brush.

This tool convolves the specified drawable with either a sharpening or blurring kernel. This function performs exactly the same as the Gimp.convolve() function except that the tools arguments are obtained from the convolve option dialog. It this dialog has not been activated then the dialogs default values will be used.

Gimp.core_object_array_get_length(array)
Parameters:

array (GObject.Object) – a None-terminated array of objects.

Returns:

the number of [class`GObject`.Object] in array.

Return type:

int

Gimp.core_object_array_get_type()
Return type:

GObject.GType

Gimp.cpu_accel_get_support()
Returns:

Gimp.CpuAccelFlags as supported by the CPU.

Return type:

Gimp.CpuAccelFlags

Query for CPU acceleration support.

New in version 2.4.

Gimp.data_directory()
Returns:

The top directory for GIMP data.

Return type:

str

Returns the default top directory for GIMP data. If the environment variable GIMP3_DATADIR exists, that is used. It should be an absolute pathname. Otherwise, on Unix the compile-time defined directory is used. On Windows, the installation directory as deduced from the executable’s full filename is used.

Note that the actual directories used for GIMP data files can be overridden by the user in the preferences dialog.

In config files such as gimprc, the string ${gimp_data_dir} expands to this directory.

The returned string is owned by GIMP and must not be modified or freed. The returned string is in the encoding used for filenames by GLib, which isn’t necessarily UTF-8. (On Windows it always is UTF-8.)

Gimp.debug_timer_end()
Returns:

The elapsed time, in seconds.

Return type:

float

Finishes measuring elapsed time.

This procedure stops the timer started by a previous Gimp.debug_timer_start() call, and prints and returns the elapsed time. If there was already an active timer at the time of corresponding call to Gimp.debug_timer_start(), a dummy value is returned.

This is a debug utility procedure. It is subject to change at any point, and should not be used in production.

Gimp.debug_timer_start()
Returns:

True on success.

Return type:

bool

Starts measuring elapsed time.

This procedure starts a timer, measuring the elapsed time since the call. Each call to this procedure should be matched by a call to Gimp.debug_timer_end(), which returns the elapsed time. If there is already an active timer, it is not affected by the call, however, a matching Gimp.debug_timer_end() call is still required.

This is a debug utility procedure. It is subject to change at any point, and should not be used in production.

Gimp.default_display()
Returns:

the default display ID The object belongs to libgimp and you should not free it.

Return type:

Gimp.Display

Returns the default display ID. This corresponds to the display the running procedure’s menu entry was invoked from.

This is a constant value given at plug-in configuration time.

Gimp.detach_parasite(name)
Parameters:

name (str) – The name of the parasite to detach.

Returns:

True on success.

Return type:

bool

Removes a global parasite.

This procedure detaches a global parasite from. It has no return values.

New in version 2.8.

Gimp.directory()
Returns:

The user-specific GIMP settings directory.

Return type:

str

Returns the user-specific GIMP settings directory. If the environment variable GIMP3_DIRECTORY exists, it is used. If it is an absolute path, it is used as is. If it is a relative path, it is taken to be a subdirectory of the home directory. If it is a relative path, and no home directory can be determined, it is taken to be a subdirectory of Gimp.data_directory().

The usual case is that no GIMP3_DIRECTORY environment variable exists, and then we use the GIMPDIR subdirectory of the local configuration directory:

  • UNIX: $XDG_CONFIG_HOME (defaults to $HOME/.config/)

  • Windows: CSIDL_APPDATA

  • OSX (UNIX exception): the Application Support Directory.

If neither the configuration nor home directory exist, GLib.get_user_config_dir() will return {tmp}/{user_name}/.config/ where the temporary directory {tmp} and the {user_name} are determined according to platform rules.

In any case, we always return some non-empty string, whether it corresponds to an existing directory or not.

In config files such as gimprc, the string ${gimp_dir} expands to this directory.

The returned string is owned by GIMP and must not be modified or freed. The returned string is in the encoding used for filenames by GLib, which isn’t necessarily UTF-8 (on Windows it is always UTF-8.)

Gimp.displays_flush()
Returns:

True on success.

Return type:

bool

Flush all internal changes to the user interface

This procedure takes no arguments and returns nothing except a success status. Its purpose is to flush all pending updates of image manipulations to the user interface. It should be called whenever appropriate.

Gimp.displays_reconnect(old_image, new_image)
Parameters:
  • old_image (Gimp.Image) – The old image (must have at least one display).

  • new_image (Gimp.Image) – The new image (must not have a display).

Returns:

True on success.

Return type:

bool

Reconnect displays from one image to another image.

This procedure connects all displays of the old_image to the new_image. If the old_image has no display or new_image already has a display the reconnect is not performed and the procedure returns without success. You should rarely need to use this function.

Gimp.dodgeburn(drawable, exposure, dodgeburn_type, dodgeburn_mode, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • exposure (float) – The exposure of the strokes.

  • dodgeburn_type (Gimp.DodgeBurnType) – The type either dodge or burn.

  • dodgeburn_mode (Gimp.TransferMode) – The mode.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Dodgeburn image with varying exposure.

Dodgeburn. More details here later.

Gimp.dodgeburn_default(drawable, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Dodgeburn image with varying exposure. This is the same as the Gimp.dodgeburn() function except that the exposure, type and mode are taken from the tools option dialog. If the dialog has not been activated then the defaults as used by the dialog will be used.

Dodgeburn. More details here later.

Gimp.double_array_get_values(array)
Parameters:

array (Gimp.Array) – the Gimp.Array representing #double values.

Returns:

a C-array of float.

Return type:

[float]

Gimp.double_array_set_values(array, values, static_data)
Parameters:
  • array (Gimp.Array) – the array to modify.

  • values ([float]) – the C-array.

  • static_data (bool) – whether data is a static rather than allocated array.

Gimp.drawables_close_popup(callback)
Parameters:

callback (str) – The name of the callback registered for this pop-up.

Returns:

True on success.

Return type:

bool

Close the drawable selection dialog.

Closes an open drawable selection dialog.

Gimp.drawables_popup(callback, popup_title, drawable_type, initial_drawable, parent_window)
Parameters:
  • callback (str) – The callback PDB proc to call when user chooses an drawable.

  • popup_title (str) – Title of the drawable selection dialog.

  • drawable_type (str) – The name of the GIMP_TYPE_DRAWABLE subtype.

  • initial_drawable (Gimp.Drawable or None) – The drawable to set as the initial choice.

  • parent_window (GLib.Bytes or None) – An optional parent window handle for the popup to be set transient to.

Returns:

True on success.

Return type:

bool

Invokes the drawable selection dialog.

Opens a dialog letting a user choose an drawable.

Gimp.drawables_set_popup(callback, drawable)
Parameters:
  • callback (str) – The name of the callback registered for this pop-up.

  • drawable (Gimp.Drawable) – The drawable to set as selected.

Returns:

True on success.

Return type:

bool

Sets the selected drawable in a drawable selection dialog.

Sets the selected drawable in a drawable selection dialog.

Gimp.dynamics_get_name_list(filter)
Parameters:

filter (str or None) – An optional regular expression used to filter the list.

Returns:

The list of paint dynamics names. The returned value must be freed with GLib.strfreev().

Return type:

[str]

Retrieve the list of loaded paint dynamics.

This procedure returns a list of the paint dynamics that are currently available.

New in version 2.8.

Gimp.dynamics_refresh()
Returns:

True on success.

Return type:

bool

Refresh current paint dynamics. This function always succeeds.

This procedure retrieves all paint dynamics currently in the user’s paint dynamics path and updates the paint dynamics dialogs accordingly.

New in version 2.8.

Gimp.edit_copy(drawables)
Parameters:

drawables ([Gimp.Drawable]) – Drawables to copy from.

Returns:

True if the cut was successful, False if there was nothing to copy from.

Return type:

bool

Copy from the specified drawables.

If there is a selection in the image, then the area specified by the selection is copied from the specified drawables and placed in an internal GIMP edit buffer. It can subsequently be retrieved using the Gimp.edit_paste() command. If there is no selection, then the specified drawables’ contents will be stored in the internal GIMP edit buffer. This procedure will return False if the selected area lies completely outside the bounds of the current drawables and there is nothing to copy from. All the drawables must belong to the same image.

Gimp.edit_copy_visible(image)
Parameters:

image (Gimp.Image) – The image to copy from.

Returns:

True if the copy was successful.

Return type:

bool

Copy from the projection.

If there is a selection in the image, then the area specified by the selection is copied from the projection and placed in an internal GIMP edit buffer. It can subsequently be retrieved using the Gimp.edit_paste() command. If there is no selection, then the projection’s contents will be stored in the internal GIMP edit buffer.

New in version 2.2.

Gimp.edit_cut(drawables)
Parameters:

drawables ([Gimp.Drawable]) – The drawables to cut from.

Returns:

True if the cut was successful, False if there was nothing to copy from.

Return type:

bool

Cut from the specified drawables.

If there is a selection in the image, then the area specified by the selection is cut from the specified drawables and placed in an internal GIMP edit buffer. It can subsequently be retrieved using the Gimp.edit_paste() command. If there is no selection and only one specified drawable, then the specified drawable will be removed and its contents stored in the internal GIMP edit buffer. This procedure will return False if the selected area lies completely outside the bounds of the current drawables and there is nothing to cut from.

Gimp.edit_named_copy(drawables, buffer_name)
Parameters:
  • drawables ([Gimp.Drawable]) – The drawables to copy from.

  • buffer_name (str) – The name of the buffer to create.

Returns:

The real name given to the buffer, or None if the copy failed. The returned value must be freed with GLib.free().

Return type:

str

Copy into a named buffer.

This procedure works like Gimp.edit_copy(), but additionally stores the copied buffer into a named buffer that will stay available for later pasting, regardless of any intermediate copy or cut operations.

New in version 2.4.

Gimp.edit_named_copy_visible(image, buffer_name)
Parameters:
  • image (Gimp.Image) – The image to copy from.

  • buffer_name (str) – The name of the buffer to create.

Returns:

The real name given to the buffer, or None if the copy failed. The returned value must be freed with GLib.free().

Return type:

str

Copy from the projection into a named buffer.

This procedure works like Gimp.edit_copy_visible(), but additionally stores the copied buffer into a named buffer that will stay available for later pasting, regardless of any intermediate copy or cut operations.

New in version 2.4.

Gimp.edit_named_cut(drawables, buffer_name)
Parameters:
  • drawables ([Gimp.Drawable]) – The drawables to cut from.

  • buffer_name (str) – The name of the buffer to create.

Returns:

The real name given to the buffer, or None if the cut failed. The returned value must be freed with GLib.free().

Return type:

str

Cut into a named buffer.

This procedure works like Gimp.edit_cut(), but additionally stores the cut buffer into a named buffer that will stay available for later pasting, regardless of any intermediate copy or cut operations.

New in version 2.4.

Gimp.edit_named_paste(drawable, buffer_name, paste_into)
Parameters:
  • drawable (Gimp.Drawable) – The drawable to paste to.

  • buffer_name (str) – The name of the buffer to paste.

  • paste_into (bool) – Clear selection, or paste behind it?

Returns:

The new floating selection.

Return type:

Gimp.Layer

Paste named buffer to the specified drawable.

This procedure works like Gimp.edit_paste() but pastes a named buffer instead of the global buffer.

New in version 2.4.

Gimp.edit_named_paste_as_new_image(buffer_name)
Parameters:

buffer_name (str) – The name of the buffer to paste.

Returns:

The new image.

Return type:

Gimp.Image

Paste named buffer to a new image.

This procedure works like Gimp.edit_paste_as_new_image() but pastes a named buffer instead of the global buffer.

New in version 2.10.

Gimp.edit_paste(drawable, paste_into)
Parameters:
  • drawable (Gimp.Drawable) – The drawable to paste to.

  • paste_into (bool) – Clear selection, or paste behind it?

Returns:

The list of pasted layers. The returned value must be freed with GLib.free().

Return type:

[Gimp.Drawable]

Paste buffer to the specified drawable.

This procedure pastes a copy of the internal GIMP edit buffer to the specified drawable. The GIMP edit buffer will be empty unless a call was previously made to either [func`Gimp`.edit_cut] or [func`Gimp`.edit_copy]. The \”paste_into\” option specifies whether to clear the current image selection, or to paste the buffer \”behind\” the selection. This allows the selection to act as a mask for the pasted buffer. Anywhere that the selection mask is non-zero, the pasted buffer will show through. The pasted data may be a floating selection when relevant, layers otherwise. If the image has a floating selection at the time of pasting, the old floating selection will be anchored to its drawable before the new floating selection is added. This procedure returns the new drawables (floating or not). If the result is a floating selection, it will already be attached to the specified drawable, and a subsequent call to [func`Gimp`.floating_sel_attach] is not needed.

Gimp.edit_paste_as_new_image()
Returns:

The new image.

Return type:

Gimp.Image

Paste buffer to a new image.

This procedure pastes a copy of the internal GIMP edit buffer to a new image. The GIMP edit buffer will be empty unless a call was previously made to either Gimp.edit_cut() or Gimp.edit_copy(). This procedure returns the new image or -1 if the edit buffer was empty.

New in version 2.10.

Gimp.enum_get_desc(enum_class, value)
Parameters:
Returns:

the value’s Gimp.EnumDesc.

Return type:

Gimp.EnumDesc or None

Retrieves Gimp.EnumDesc associated with the given value, or None.

New in version 2.2.

Gimp.enum_get_value(enum_type, value)
Parameters:
Returns:

True if value is valid for the enum_type, False otherwise

value_name:

return location for the value’s name, or None

value_nick:

return location for the value’s nick, or None

value_desc:

return location for the value’s translated description, or None

value_help:

return location for the value’s translated help, or None

Return type:

(bool, value_name: str, value_nick: str, value_desc: str, value_help: str)

Checks if value is valid for the enum registered as enum_type. If the value exists in that enum, its name, nick and its translated description and help are returned (if value_name, value_nick, value_desc and value_help are not None).

New in version 2.2.

Gimp.enum_get_value_descriptions(enum_type)
Parameters:

enum_type (GObject.GType) – a GObject.GType

Returns:

a None terminated constant array of Gimp.EnumDesc

Return type:

Gimp.EnumDesc

Retrieves the array of human readable and translatable descriptions and help texts for enum values.

New in version 2.2.

Gimp.enum_set_value_descriptions(enum_type, descriptions)
Parameters:

Sets the array of human readable and translatable descriptions and help texts for enum values.

New in version 2.2.

Gimp.enum_value_get_abbrev(enum_class, enum_value)
Parameters:
Returns:

the translated abbreviation of the enum value

Return type:

str

Retrieves the translated abbreviation for a given enum_value.

New in version 2.10.

Gimp.enum_value_get_desc(enum_class, enum_value)
Parameters:
Returns:

the translated description of the enum value

Return type:

str

Retrieves the translated description for a given enum_value.

New in version 2.2.

Gimp.enum_value_get_help(enum_class, enum_value)
Parameters:
Returns:

the translated help of the enum value

Return type:

str

Retrieves the translated help for a given enum_value.

New in version 2.2.

Gimp.enums_get_type_names()
Returns:

an array with type names

Return type:

[str]

This function gives access to the list of enums registered by libgimp. The returned array is static and must not be modified.

New in version 2.2.

Gimp.enums_init()

This function makes sure all the enum types are registered with the GObject.GType system. This is intended for use by language bindings that need the symbols early, before Gimp.main is run. It’s not necessary for plug-ins to call this directly, because the normal plug-in initialization code will handle it implicitly.

New in version 2.4.

Gimp.eraser(drawable, strokes, hardness, method)
Parameters:
Returns:

True on success.

Return type:

bool

Erase using the current brush.

This tool erases using the current brush mask. If the specified drawable contains an alpha channel, then the erased pixels will become transparent. Otherwise, the eraser tool replaces the contents of the drawable with the background color. Like paintbrush, this tool linearly interpolates between the specified stroke coordinates.

Gimp.eraser_default(drawable, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Erase using the current brush.

This tool erases using the current brush mask. This function performs exactly the same as the Gimp.eraser() function except that the tools arguments are obtained from the eraser option dialog. It this dialog has not been activated then the dialogs default values will be used.

Gimp.escape_uline(str)
Parameters:

str (str or None) – Underline infested string (or None)

Returns:

A (possibly escaped) copy of str which should be freed using GLib.free() when it is not needed any longer.

Return type:

str

This function returns a copy of str with all underline converted to two adjacent underlines. This comes in handy when needing to display strings with underlines (like filenames) in a place that would convert them to mnemonics.

New in version 2.2.

Gimp.export_color_profile()
Returns:

True if preferences are set to export the color profile.

Return type:

bool

Returns whether file plug-ins should default to exporting the image’s color profile.

New in version 2.10.4.

Gimp.export_comment()
Returns:

True if preferences are set to export the comment.

Return type:

bool

Returns whether file plug-ins should default to exporting the image’s comment.

New in version 3.0.

Gimp.export_exif()
Returns:

True if preferences are set to export Exif.

Return type:

bool

Returns whether file plug-ins should default to exporting Exif metadata, according preferences (original settings is False since metadata can contain sensitive information).

New in version 2.10.

Gimp.export_iptc()
Returns:

True if preferences are set to export IPTC.

Return type:

bool

Returns whether file plug-ins should default to exporting IPTC metadata, according preferences (original settings is False since metadata can contain sensitive information).

New in version 2.10.

Gimp.export_thumbnail()
Returns:

True if preferences are set to export the thumbnail.

Return type:

bool

Returns whether file plug-ins should default to exporting the image’s comment.

New in version 3.0.

Gimp.export_xmp()
Returns:

True if preferences are set to export XMP.

Return type:

bool

Returns whether file plug-ins should default to exporting XMP metadata, according preferences (original settings is False since metadata can contain sensitive information).

New in version 2.10.

Gimp.file_create_thumbnail(image, file)
Parameters:
  • image (Gimp.Image) – The image.

  • file (Gio.File) – The file the thumbnail belongs to.

Returns:

True on success.

Return type:

bool

Creates a thumbnail of image for the given file

This procedure creates a thumbnail for the given file and stores it according to relevant standards. In particular, it will follow the Free Desktop Thumbnail Managing Standard when relevant.

The thumbnail is stored so that it belongs to the given file. This means you have to save image under this name first. As a fallback, the call will work if image was exported or imported as file. In any other case, this procedure will fail.

Gimp.file_get_config_path(file)
Parameters:

file (Gio.File) – a Gio.File

Raises:

GLib.Error

Returns:

a newly allocated NUL-terminated UTF-8 string, or None if unexpanding failed.

Return type:

str

Unexpands file's path using Gimp.ConfigPath.unexpand() and returns the unexpanded path.

The inverse operation of Gimp.file_new_for_config_path().

New in version 2.10.

Gimp.file_get_utf8_name(file)
Parameters:

file (Gio.File) – a Gio.File

Returns:

A temporarily valid UTF-8 representation of file's name. This string must not be changed or freed.

Return type:

str

This function works like Gimp.filename_to_utf8() and returns a UTF-8 encoded string that does not need to be freed.

It converts a Gio.File's path or uri to UTF-8 temporarily. The return value is a pointer to a string that is guaranteed to be valid only during the current iteration of the main loop or until the next call to Gimp.file_get_utf8_name().

The only purpose of this function is to provide an easy way to pass a Gio.File's name to a function that expects an UTF-8 encoded string.

See Gio.File.get_parse_name().

New in version 2.10.

Gimp.file_has_extension(file, extension)
Parameters:
Returns:

True if file's URI ends with extension, False otherwise.

Return type:

bool

This function checks if file's URI ends with extension. It behaves like GLib.str_has_suffix() on Gio.File.get_uri(), except that the string comparison is done case-insensitively using GLib.ascii_strcasecmp().

New in version 2.10.

Gimp.file_load(run_mode, file)
Parameters:
Returns:

The output image.

Return type:

Gimp.Image

Loads an image file by invoking the right load handler.

This procedure invokes the correct file load handler using magic if possible, and falling back on the file’s extension and/or prefix if not.

Gimp.file_load_layer(run_mode, image, file)
Parameters:
Returns:

The layer created when loading the image file.

Return type:

Gimp.Layer

Loads an image file as a layer for an existing image.

This procedure behaves like the file-load procedure but opens the specified image as a layer for an existing image. The returned layer needs to be added to the existing image with Gimp.Image.insert_layer().

New in version 2.4.

Gimp.file_load_layers(run_mode, image, file)
Parameters:
Returns:

The list of loaded layers. The returned value must be freed with GLib.free().

Return type:

[Gimp.Layer]

Loads an image file as layers for an existing image.

This procedure behaves like the file-load procedure but opens the specified image as layers for an existing image. The returned layers needs to be added to the existing image with Gimp.Image.insert_layer().

New in version 2.4.

Gimp.file_new_for_config_path(path)
Parameters:

path (str) – a NUL-terminated string in UTF-8 encoding

Raises:

GLib.Error

Returns:

a newly allocated Gio.File, or None if the expansion failed.

Return type:

Gio.File or None

Expands path using Gimp.ConfigPath.expand() and returns a Gio.File for the expanded path.

To reverse the expansion, use Gimp.file_get_config_path().

New in version 2.10.

Gimp.file_save(run_mode, image, file, options)
Parameters:
Returns:

True on success.

Return type:

bool

Saves to XCF or export image to any supported format by extension.

This procedure invokes the correct file save/export handler according to file's extension and/or prefix.

The options argument is currently unused and should be set to None right now.

Gimp.file_show_in_file_manager(file)
Parameters:

file (Gio.File) – a Gio.File

Raises:

GLib.Error

Returns:

True on success, False otherwise. On False, error is set.

Return type:

bool

Shows file in the system file manager.

New in version 2.10.

Gimp.filename_to_utf8(filename)
Parameters:

filename (str) – The filename to be converted to UTF-8.

Returns:

A temporarily valid UTF-8 representation of filename. This string must not be changed or freed.

Return type:

str

Convert a filename in the filesystem’s encoding to UTF-8 temporarily. The return value is a pointer to a string that is guaranteed to be valid only during the current iteration of the main loop or until the next call to Gimp.filename_to_utf8().

The only purpose of this function is to provide an easy way to pass a filename in the filesystem encoding to a function that expects an UTF-8 encoded filename.

Gimp.flags_get_first_desc(flags_class, value)
Parameters:
Returns:

the value’s Gimp.FlagsDesc.

Return type:

Gimp.FlagsDesc or None

Retrieves the first Gimp.FlagsDesc that matches the given value, or None.

New in version 2.2.

Gimp.flags_get_first_value(flags_type, value)
Parameters:
Returns:

True if value is valid for the flags_type, False otherwise

value_name:

return location for the value’s name, or None

value_nick:

return location for the value’s nick, or None

value_desc:

return location for the value’s translated description, or None

value_help:

return location for the value’s translated help, or None

Return type:

(bool, value_name: str, value_nick: str, value_desc: str, value_help: str)

Checks if value is valid for the flags registered as flags_type. If the value exists in that flags, its name, nick and its translated description and help are returned (if value_name, value_nick, value_desc and value_help are not None).

New in version 2.2.

Gimp.flags_get_value_descriptions(flags_type)
Parameters:

flags_type (GObject.GType) – a GObject.GType

Returns:

a None terminated constant array of Gimp.FlagsDesc

Return type:

Gimp.FlagsDesc

Retrieves the array of human readable and translatable descriptions and help texts for flags values.

New in version 2.2.

Gimp.flags_set_value_descriptions(flags_type, descriptions)
Parameters:

Sets the array of human readable and translatable descriptions and help texts for flags values.

New in version 2.2.

Gimp.flags_value_get_abbrev(flags_class, flags_value)
Parameters:
Returns:

the translated abbreviation of the flags value

Return type:

str

Retrieves the translated abbreviation for a given flags_value.

New in version 2.10.

Gimp.flags_value_get_desc(flags_class, flags_value)
Parameters:
Returns:

the translated description of the flags value

Return type:

str

Retrieves the translated description for a given flags_value.

New in version 2.2.

Gimp.flags_value_get_help(flags_class, flags_value)
Parameters:
Returns:

the translated help of the flags value

Return type:

str

Retrieves the translated help for a given flags_value.

New in version 2.2.

Gimp.floating_sel_anchor(floating_sel)
Parameters:

floating_sel (Gimp.Layer) – The floating selection.

Returns:

True on success.

Return type:

bool

Anchor the specified floating selection to its associated drawable.

This procedure anchors the floating selection to its associated drawable. This is similar to merging with a merge type of ClipToBottomLayer. The floating selection layer is no longer valid after this operation.

Gimp.floating_sel_attach(layer, drawable)
Parameters:
  • layer (Gimp.Layer) – The layer (is attached as floating selection).

  • drawable (Gimp.Drawable) – The drawable (where to attach the floating selection).

Returns:

True on success.

Return type:

bool

Attach the specified layer as floating to the specified drawable.

This procedure attaches the layer as floating selection to the drawable.

Gimp.floating_sel_remove(floating_sel)
Parameters:

floating_sel (Gimp.Layer) – The floating selection.

Returns:

True on success.

Return type:

bool

Remove the specified floating selection from its associated drawable.

This procedure removes the floating selection completely, without any side effects. The associated drawable is then set to active.

Gimp.floating_sel_to_layer(floating_sel)
Parameters:

floating_sel (Gimp.Layer) – The floating selection.

Returns:

True on success.

Return type:

bool

Transforms the specified floating selection into a layer.

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 auxiliary channel or a layer mask.

Gimp.fonts_close_popup(font_callback)
Parameters:

font_callback (str) – The name of the callback registered in the PDB for this dialog.

Returns:

True on success.

Return type:

bool

Close the font selection dialog.

Closes an open font selection dialog.

Gimp.fonts_get_list(filter)
Parameters:

filter (str or None) – An optional regular expression used to filter the list.

Returns:

The list of fonts. The returned value must be freed with GLib.free().

Return type:

[Gimp.Font]

Retrieve the list of loaded fonts.

This procedure returns a list of the fonts that are currently available. Each font returned can be used as input to [func`Gimp`.context_set_font].

Gimp.fonts_popup(font_callback, popup_title, initial_font, parent_window)
Parameters:
  • font_callback (str) – The callback PDB proc to call when user chooses a font.

  • popup_title (str) – Title of the font selection dialog.

  • initial_font (Gimp.Font or None) – The name of the initial font choice.

  • parent_window (GLib.Bytes or None) – An optional parent window handle for the popup to be set transient to.

Returns:

True on success.

Return type:

bool

Invokes the Gimp font selection dialog.

Opens a dialog letting a user choose a font.

Gimp.fonts_refresh()
Returns:

True on success.

Return type:

bool

Refresh current fonts. This function always succeeds.

This procedure retrieves all fonts currently in the user’s font path and updates the font dialogs accordingly. Depending on the amount of fonts on the system, this can take considerable time.

Gimp.fonts_set_popup(font_callback, font)
Parameters:
  • font_callback (str) – The name of the callback registered in the PDB for the dialog.

  • font (Gimp.Font) – The font to set as selected.

Returns:

True on success.

Return type:

bool

Sets the current font in a font selection dialog.

Sets the current font in a font selection dialog.

Gimp.get_color_configuration()
Returns:

A copy of the core’s Gimp.ColorConfig. You should unref this copy if you don’t need it any longer.

Return type:

Gimp.ColorConfig

Retrieve a copy of the current color management configuration.

New in version 2.4.

Gimp.get_default_comment()
Returns:

Default image comment. The returned value must be freed with GLib.free().

Return type:

str

Get the default image comment as specified in the Preferences.

Returns a copy of the default image comment.

Gimp.get_default_unit()
Returns:

Default unit.

Return type:

Gimp.Unit

Get the default unit (taken from the user’s locale).

Returns the default unit.

New in version 2.4.

Gimp.get_images()
Returns:

The list of images currently open. The returned value must be freed with GLib.free().

Return type:

[Gimp.Image]

Returns the list of images currently open.

This procedure returns the list of images currently open in GIMP.

Gimp.get_module_load_inhibit()
Returns:

The list of modules. The returned value must be freed with GLib.free().

Return type:

str

Get the list of modules which should not be loaded.

Returns a copy of the list of modules which should not be loaded.

Gimp.get_monitor_resolution()
Returns:

True on success.

xres:

X resolution.

yres:

Y resolution.

Return type:

(bool, xres: float, yres: float)

Get the monitor resolution as specified in the Preferences.

Returns the resolution of the monitor in pixels/inch. This value is taken from the Preferences (or the windowing system if this is set in the Preferences) and there’s no guarantee for the value to be reasonable.

Gimp.get_num_processors()
Returns:

the preferred number of threads to use.

Return type:

int

Returns the number of threads set explicitly by the user in the preferences. This information can be used by plug-ins wishing to follow user settings for multi-threaded implementations.

New in version 3.0.

Gimp.get_parasite(name)
Parameters:

name (str) – The name of the parasite to find.

Returns:

The found parasite.

Return type:

Gimp.Parasite

Look up a global parasite.

Finds and returns the global parasite that was previously attached.

New in version 2.8.

Gimp.get_parasite_list()
Returns:

The names of currently attached parasites. The returned value must be freed with GLib.strfreev().

Return type:

[str]

List all parasites.

Returns a list of all currently attached global parasites.

New in version 2.8.

Gimp.get_pdb()
Returns:

The plug-in’s Gimp.PDB singleton.

Return type:

Gimp.PDB or None

This function returns the plug-in’s Gimp.PDB instance, which is a singleton that can exist exactly once per running plug-in.

New in version 3.0.

Gimp.get_plug_in()
Returns:

The plug-in’s Gimp.PlugIn singleton.

Return type:

Gimp.PlugIn or None

This function returns the plug-in’s Gimp.PlugIn instance, which is a a singleton that can exist exactly once per running plug-in.

New in version 3.0.

Gimp.get_progname()
Returns:

the executable name

Return type:

str

Returns the plug-in’s executable name.

Gimp.getpid()
Returns:

The PID.

Return type:

int

Returns the PID of the host GIMP process.

This procedure returns the process ID of the currently running GIMP.

New in version 2.4.

Gimp.gimprc_query(token)
Parameters:

token (str) – The token to query for.

Returns:

The value associated with the queried token. The returned value must be freed with GLib.free().

Return type:

str

Queries the gimprc file parser for information on a specified token.

This procedure is used to locate additional information contained in the gimprc file considered extraneous to the operation of GIMP. Plug-ins that need configuration information can expect it will be stored in the user gimprc file and can use this procedure to retrieve it. This query procedure will return the value associated with the specified token. This corresponds _only_ to entries with the format: (<token> <value>). The value must be a string. Entries not corresponding to this format will cause warnings to be issued on gimprc parsing and will not be queryable.

Gimp.gimprc_set(token, value)
Parameters:
  • token (str) – The token to add or modify.

  • value (str) – The value to set the token to.

Returns:

True on success.

Return type:

bool

Sets a gimprc token to a value and saves it in the gimprc.

This procedure is used to add or change additional information in the gimprc file that is considered extraneous to the operation of GIMP. Plug-ins that need configuration information can use this function to store it, and Gimp.gimprc_query() to retrieve it. This will accept _only_ string values in UTF-8 encoding.

Gimp.gradients_close_popup(gradient_callback)
Parameters:

gradient_callback (str) – The name of the callback registered for this pop-up.

Returns:

True on success.

Return type:

bool

Close the gradient selection dialog.

Closes an open gradient selection dialog.

Gimp.gradients_get_list(filter)
Parameters:

filter (str or None) – An optional regular expression used to filter the list.

Returns:

The list of gradients. The returned value must be freed with GLib.free().

Return type:

[Gimp.Gradient]

Retrieve the list of loaded gradients.

This procedure returns a list of the gradients that are currently loaded. Each gradient returned can be used as input to [func`Gimp`.context_set_gradient].

Gimp.gradients_popup(gradient_callback, popup_title, initial_gradient, parent_window)
Parameters:
  • gradient_callback (str) – The callback PDB proc to call when user chooses a gradient.

  • popup_title (str) – Title of the gradient selection dialog.

  • initial_gradient (Gimp.Gradient or None) – The initial gradient choice.

  • parent_window (GLib.Bytes or None) – An optional parent window handle for the popup to be set transient to.

Returns:

True on success.

Return type:

bool

Invokes the Gimp gradients selection dialog.

Opens a dialog letting a user choose a gradient.

Gimp.gradients_refresh()
Returns:

True on success.

Return type:

bool

Refresh current gradients. This function always succeeds.

This procedure retrieves all gradients currently in the user’s gradient path and updates the gradient dialogs accordingly.

Gimp.gradients_set_popup(gradient_callback, gradient)
Parameters:
  • gradient_callback (str) – The name of the callback registered for this pop-up.

  • gradient (Gimp.Gradient) – The gradient to set as selected.

Returns:

True on success.

Return type:

bool

Sets the current gradient in a gradient selection dialog.

Sets the current gradient in a gradient selection dialog.

Gimp.heal(drawable, src_drawable, src_x, src_y, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • src_drawable (Gimp.Drawable) – The source drawable.

  • src_x (float) – The x coordinate in the source image.

  • src_y (float) – The y coordinate in the source image.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Heal from the source to the dest drawable using the current brush

This tool heals the source drawable starting at the specified source coordinates to the dest drawable. For image healing, if the sum of the src coordinates and subsequent stroke offsets exceeds the extents of the src drawable, then no paint is transferred. The healing tool is capable of transforming between any image types except RGB->Indexed.

New in version 2.4.

Gimp.heal_default(drawable, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Heal from the source to the dest drawable using the current brush

This tool heals from the source drawable starting at the specified source coordinates to the dest drawable. This function performs exactly the same as the Gimp.heal() function except that the tools arguments are obtained from the healing option dialog. It this dialog has not been activated then the dialogs default values will be used.

New in version 2.4.

Gimp.help(help_domain, help_id)
Parameters:
  • help_domain (str or None) – The help domain in which help_id is registered.

  • help_id (str) – The help page’s ID.

Returns:

True on success.

Return type:

bool

Load a help page.

This procedure loads the specified help page into the helpbrowser or what ever is configured as help viewer. The help page is identified by its domain and ID: if help_domain is None, we use the help_domain which was registered using the gimp_plugin_help_register() procedure. If help_domain is None and no help domain was registered, the help domain of the main GIMP installation is used.

Gimp.icon_theme_dir()
Returns:

the icon theme directory

Return type:

str

Returns the directory of the current icon theme.

This is a constant value given at plug-in configuration time.

New in version 2.10.4.

Gimp.installation_directory()
Returns:

The toplevel installation directory of GIMP.

Return type:

str

Returns the top installation directory of GIMP. On Unix the compile-time defined installation prefix is used. On Windows, the installation directory as deduced from the executable’s full filename is used. On OSX we ask [NSBundle mainBundle] for the resource path to check if GIMP is part of a relocatable bundle.

In config files such as gimprc, the string ${gimp_installation_dir} expands to this directory.

The returned string is owned by GIMP and must not be modified or freed. The returned string is in the encoding used for filenames by GLib, which isn’t necessarily UTF-8. (On Windows it always is UTF-8.)

New in version 2.8.

Gimp.int32_array_get_values(array)
Parameters:

array (Gimp.Array) – the Gimp.Array representing #int32 values.

Returns:

a C-array of #gint32.

Return type:

[int]

Gimp.int32_array_set_values(array, values, static_data)
Parameters:
  • array (Gimp.Array) – the array to modify.

  • values ([int]) – the C-array.

  • static_data (bool) – whether data is a static rather than allocated array.

Gimp.is_canonical_identifier(identifier)
Parameters:

identifier (str) – The identifier string to check.

Returns:

True if identifier is canonical, False otherwise.

Return type:

bool

Checks if identifier is canonical and non-None.

Canonical identifiers are e.g. expected by the PDB for procedure and parameter names. Every character of the input string must be either ‘-’, ‘a-z’, ‘A-Z’ or ‘0-9’.

New in version 3.0.

Gimp.locale_directory()
Returns:

The top directory for GIMP locale files.

Return type:

str

Returns the top directory for GIMP locale files. If the environment variable GIMP3_LOCALEDIR exists, that is used. It should be an absolute pathname. Otherwise, on Unix the compile-time defined directory is used. On Windows, the installation directory as deduced from the executable’s full filename is used.

The returned string is owned by GIMP and must not be modified or freed. The returned string encoding depends on the system where GIMP is running: on UNIX it’s in the encoding used for filenames by the C library (which isn’t necessarily UTF-8); on Windows it’s UTF-8.

On UNIX the returned string can be passed directly to the bindtextdomain() function from libintl; on Windows the returned string can be converted to UTF-16 and passed to the wbindtextdomain() function from libintl.

Gimp.main(plug_in_type, argv)
Parameters:
Returns:

an exit status as defined by the C library, on success EXIT_SUCCESS.

Return type:

int

The main plug-in function that must be called with the plug-in’s [class`Gimp`.PlugIn] subclass GObject.GType and the ‘argc’ and ‘argv’ that are passed to the platform’s main().

For instance, in Python, you will want to end your plug-in with this call:

``py Gimp.main(MyPlugIn.__gtype__, sys.argv) ``

For C plug-ins, use instead the [func`Gimp`.MAIN] macro

New in version 3.0.

Gimp.message(message)
Parameters:

message (str) – Message to display in the dialog.

Returns:

True on success.

Return type:

bool

Displays a dialog box with a message.

Displays a dialog box with a message. Useful for status or error reporting. The message must be in UTF-8 encoding.

Gimp.message_get_handler()
Returns:

The current handler type.

Return type:

Gimp.MessageHandlerType

Returns the current state of where warning messages are displayed.

This procedure returns the way g_message warnings are displayed. They can be shown in a dialog box or printed on the console where gimp was started.

Gimp.message_set_handler(handler)
Parameters:

handler (Gimp.MessageHandlerType) – The new handler type.

Returns:

True on success.

Return type:

bool

Controls where warning messages are displayed.

This procedure controls how g_message warnings are displayed. They can be shown in a dialog box or printed on the console where gimp was started.

Gimp.monitor_number()
Returns:

the monitor number

Return type:

int

Returns the monitor number to be used for plug-in windows.

This is a constant value given at plug-in configuration time.

Gimp.paintbrush(drawable, fade_out, strokes, method, gradient_length)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • fade_out (float) – Fade out parameter.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

  • method (Gimp.PaintApplicationMode) – The paint method to use.

  • gradient_length (float) – Length of gradient to draw.

Returns:

True on success.

Return type:

bool

Paint in the current brush with optional fade out parameter and pull colors from a gradient.

This tool is the standard paintbrush. It draws linearly interpolated lines through the specified stroke coordinates. It operates on the specified drawable in the foreground color with the active brush. The ‘fade-out’ parameter is measured in pixels and allows the brush stroke to linearly fall off. The pressure is set to the maximum at the beginning of the stroke. As the distance of the stroke nears the fade-out value, the pressure will approach zero. The gradient-length is the distance to spread the gradient over. It is measured in pixels. If the gradient-length is 0, no gradient is used.

Gimp.paintbrush_default(drawable, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Paint in the current brush. The fade out parameter and pull colors from a gradient parameter are set from the paintbrush options dialog. If this dialog has not been activated then the dialog defaults will be used.

This tool is similar to the standard paintbrush. It draws linearly interpolated lines through the specified stroke coordinates. It operates on the specified drawable in the foreground color with the active brush. The ‘fade-out’ parameter is measured in pixels and allows the brush stroke to linearly fall off (value obtained from the option dialog). The pressure is set to the maximum at the beginning of the stroke. As the distance of the stroke nears the fade-out value, the pressure will approach zero. The gradient-length (value obtained from the option dialog) is the distance to spread the gradient over. It is measured in pixels. If the gradient-length is 0, no gradient is used.

Gimp.palettes_close_popup(palette_callback)
Parameters:

palette_callback (str) – The name of the callback registered for this pop-up.

Returns:

True on success.

Return type:

bool

Close the palette selection dialog.

Closes an open palette selection dialog.

Gimp.palettes_get_list(filter)
Parameters:

filter (str or None) – An optional regular expression used to filter the list.

Returns:

The list of palettes. The returned value must be freed with GLib.free().

Return type:

[Gimp.Palette]

Retrieves a list of all of the available palettes

This procedure returns a complete listing of available palettes. Each palette returned can be used as input to [func`Gimp`.context_set_palette].

Gimp.palettes_popup(palette_callback, popup_title, initial_palette, parent_window)
Parameters:
  • palette_callback (str) – The callback PDB proc to call when user chooses a palette.

  • popup_title (str) – Title of the palette selection dialog.

  • initial_palette (Gimp.Palette or None) – The palette to set as the initial choice.

  • parent_window (GLib.Bytes or None) – An optional parent window handle for the popup to be set transient to.

Returns:

True on success.

Return type:

bool

Invokes the Gimp palette selection dialog.

Opens a dialog letting a user choose a palette.

Gimp.palettes_refresh()
Returns:

True on success.

Return type:

bool

Refreshes current palettes. This function always succeeds.

This procedure retrieves all palettes currently in the user’s palette path and updates the palette dialogs accordingly.

Gimp.palettes_set_popup(palette_callback, palette)
Parameters:
  • palette_callback (str) – The name of the callback registered for this pop-up.

  • palette (Gimp.Palette) – The palette to set as selected.

Returns:

True on success.

Return type:

bool

Sets the current palette in a palette selection dialog.

Sets the current palette in a palette selection dialog.

Gimp.param_spec_array(name, nick, blurb, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecArray.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecArray specifying a [type`Array`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_brush(name, nick, blurb, none_ok, default_value, default_to_context, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether None is a valid value.

  • default_value (Gimp.Brush or None) – Default brush.

  • default_to_context (bool) – Whether the context is the context’s brush.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecBrush.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecBrush specifying a [type`Brush`] property. See also [func`Gimp`.param_spec_resource].

New in version 3.0.

Gimp.param_spec_channel(name, nick, blurb, none_ok, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether no is a valid value.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecChannel.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecChannel specifying a [type`Channel`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_choice(name, nick, blurb, choice, default_value, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • choice (Gimp.Choice) – the Gimp.Choice describing allowed choices.

  • default_value (str) –

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecChoice.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecChoice specifying a GObject.TYPE_STRING property. This %GimpParamSpecChoice takes ownership of the reference on choice.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_choice_get_choice(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.ParamSpec to hold a #GimpParamSpecChoice value.

Returns:

the choice object defining the valid values.

Return type:

Gimp.Choice

New in version 3.0.

Gimp.param_spec_choice_get_default(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.ParamSpec to hold a #GimpParamSpecChoice value.

Returns:

the default value.

Return type:

str

New in version 3.0.

Gimp.param_spec_color(name, nick, blurb, has_alpha, default_color, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str) – nick name for the property specified

  • blurb (str) – description of the property specified

  • has_alpha (bool) – True if the alpha channel has relevance.

  • default_color (Gegl.Color) – the default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpec instance specifying a Gegl.Color property. Note that the default_color is duplicated, so reusing object will not change the default color of the returned %GimpParamSpecColor.

Gimp.param_spec_color_from_string(name, nick, blurb, has_alpha, default_color_string, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str) – nick name for the property specified

  • blurb (str) – description of the property specified

  • has_alpha (bool) – True if the alpha channel has relevance.

  • default_color_string (str) – the default value for the property specified

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new GObject.ParamSpec instance specifying a Gegl.Color property.

Gimp.param_spec_color_has_alpha(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.ParamSpec to hold an Gegl.Color value.

Returns:

True if the alpha channel is relevant.

Return type:

bool

New in version 2.4.

Gimp.param_spec_config_path(name, nick, blurb, type, default_value, flags)
Parameters:
Returns:

a newly allocated GObject.ParamSpec instance

Return type:

GObject.ParamSpec

Creates a param spec to hold a filename, dir name, or list of file or dir names. See g_param_spec_internal() for more information.

New in version 2.4.

Gimp.param_spec_config_path_type(pspec)
Parameters:

pspec (GObject.ParamSpec) – A GObject.ParamSpec for a path param

Returns:

a Gimp.ConfigPathType value

Return type:

Gimp.ConfigPathType

Tells whether the path param encodes a filename, dir name, or list of file or dir names.

New in version 2.4.

Gimp.param_spec_core_object_array(name, nick, blurb, object_type, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • object_type (GObject.GType) – GObject.GType of the array’s elements.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecCoreObjectArray.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecCoreObjectArray specifying a [type`CoreObjectArray`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_core_object_array_get_object_type(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.ParamSpec to hold a #GimpParamSpecCoreObjectArray value.

Returns:

the type for objects in the object array.

Return type:

GObject.GType

New in version 3.0.

Gimp.param_spec_display(name, nick, blurb, none_ok, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether no is a valid value.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecDisplay.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecDisplay specifying a [type`Display`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_display_none_allowed(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.ParamSpec to hold a [class`Gimp`.Display] value.

Returns:

True if a None value is allowed.

Return type:

bool

New in version 3.0.

Gimp.param_spec_double_array(name, nick, blurb, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecDoubleArray.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecDoubleArray specifying a %GIMP_TYPE_DOUBLE_ARRAY property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_drawable(name, nick, blurb, none_ok, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether no is a valid value.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecDrawable.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecDrawable specifying a [type`Drawable`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_drawable_filter(name, nick, blurb, none_ok, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether no is a valid value.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecPath.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecDrawableFilter specifying a [type`DrawableFilter`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_drawable_filter_none_allowed(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.ParamSpec to hold a [class`Gimp`.DrawableFilter] value.

Returns:

True if a None value is allowed.

Return type:

bool

New in version 3.0.

Gimp.param_spec_export_options(name, nick, blurb, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecExportOptions.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecExportOptions specifying a GObject.TYPE_INT property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_file(name, nick, blurb, action, none_ok, default_value, flags)
Parameters:
Returns:

a newly allocated GObject.ParamSpec instance

Return type:

GObject.ParamSpec

Creates a param spec to hold a file param. See g_param_spec_internal() for more information.

New in version 3.0.

Gimp.param_spec_file_get_action(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.ParamSpec to hold a Gio.File value.

Returns:

the file action tied to pspec.

Return type:

Gimp.FileChooserAction

New in version 3.0.

Gimp.param_spec_file_none_allowed(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.ParamSpec to hold a Gio.File value.

Returns:

True if a None value is allowed.

Return type:

bool

New in version 3.0.

Gimp.param_spec_file_set_action(pspec, action)
Parameters:

Change the file action tied to pspec.

New in version 3.0.

Gimp.param_spec_font(name, nick, blurb, none_ok, default_value, default_to_context, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether None is a valid value.

  • default_value (Gimp.Font or None) – Default font.

  • default_to_context (bool) – Whether the context is the context’s font.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecFont.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecFont specifying a [type`Font`] property. See also [func`Gimp`.param_spec_resource].

New in version 3.0.

Gimp.param_spec_gradient(name, nick, blurb, none_ok, default_value, default_to_context, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether None is a valid value.

  • default_value (Gimp.Gradient or None) – Default gradient.

  • default_to_context (bool) – Whether the context is the context’s gradient.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecGradient.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecGradient specifying a [type`Gradient`] property. See also [func`Gimp`.param_spec_resource].

New in version 3.0.

Gimp.param_spec_group_layer(name, nick, blurb, none_ok, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether None is a valid value.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecGroupLayer.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecGroupLayer specifying a [type`GroupLayer`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_image(name, nick, blurb, none_ok, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether no is a valid value.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecImage.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecImage specifying a [type`Image`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_image_none_allowed(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.ParamSpec to hold a [class`Gimp`.Image] value.

Returns:

True if a None value is allowed.

Return type:

bool

New in version 3.0.

Gimp.param_spec_int32_array(name, nick, blurb, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecInt32Array.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecInt32Array specifying a %GIMP_TYPE_INT32_ARRAY property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_item(name, nick, blurb, none_ok, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether no is a valid value.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecItem.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecItem specifying a [type`Item`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_item_none_allowed(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.ParamSpec to hold a [class`Gimp`.Item] value.

Returns:

True if a None value is allowed.

Return type:

bool

New in version 3.0.

Gimp.param_spec_layer(name, nick, blurb, none_ok, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether no is a valid value.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecLayer.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecLayer specifying a [type`Layer`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_layer_mask(name, nick, blurb, none_ok, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether no is a valid value.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecLayerMask.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecLayerMask specifying a [type`LayerMask`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_matrix2(name, nick, blurb, default_value, flags)
Parameters:
Returns:

a newly allocated GObject.ParamSpec instance

Return type:

GObject.ParamSpec

Creates a param spec to hold a Gimp.Matrix2 value. See g_param_spec_internal() for more information.

New in version 2.4.

Gimp.param_spec_matrix3(name, nick, blurb, default_value, flags)
Parameters:
Returns:

a newly allocated GObject.ParamSpec instance

Return type:

GObject.ParamSpec

Creates a param spec to hold a Gimp.Matrix3 value. See g_param_spec_internal() for more information.

New in version 2.8.

Gimp.param_spec_memsize(name, nick, blurb, minimum, maximum, default_value, flags)
Parameters:
  • name (str) – Canonical name of the param

  • nick (str) – Nickname of the param

  • blurb (str) – Brief description of param.

  • minimum (int) – Smallest allowed value of the parameter.

  • maximum (int) – Largest allowed value of the parameter.

  • default_value (int) – Value to use if none is assigned.

  • flags (GObject.ParamFlags) – a combination of GObject.ParamFlags

Returns:

a newly allocated GObject.ParamSpec instance

Return type:

GObject.ParamSpec

Creates a param spec to hold a memory size value. See g_param_spec_internal() for more information.

New in version 2.4.

Gimp.param_spec_object_duplicate(pspec)
Parameters:

pspec (GObject.ParamSpec) – a [struct`Gimp`.ParamSpecObject].

Returns:

a newly created param spec.

Return type:

GObject.ParamSpec

This function duplicates pspec appropriately, depending on the accurate spec type.

Gimp.param_spec_object_get_default(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.Object GObject.ParamSpec

Returns:

the default value.

Return type:

GObject.Object

Get the default object value of the param spec.

If the pspec has been registered with a specific default (which can be verified with [func`Gimp`.ParamSpecObject.has_default]), it will be returned, though some specific subtypes may support returning dynamic default (e.g. based on context).

Gimp.param_spec_object_has_default(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.Object GObject.ParamSpec

Returns:

whether a default value was set.

Return type:

bool

This function tells whether a default was set, typically with [func`Gimp`.ParamSpecObject.set_default] or any other way. It does not guarantee that the default is an actual object (it may be None if valid as a default).

Gimp.param_spec_object_set_default(pspec, default_value)
Parameters:

Set the default object value of the param spec. This will switch the has_default flag so that [func`Gimp`.ParamSpecObject.has_default] will now return True.

A None default_value still counts as a default (unless the specific pspec does not allow None as a default).

Gimp.param_spec_palette(name, nick, blurb, none_ok, default_value, default_to_context, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether None is a valid value.

  • default_value (Gimp.Palette or None) – Default palette.

  • default_to_context (bool) – Whether the context is the context’s palette.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecPalette.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecPalette specifying a [type`Palette`] property. See also [func`Gimp`.param_spec_resource].

New in version 3.0.

Gimp.param_spec_parasite(name, nick, blurb, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecParasite.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecParasite specifying a [type`Parasite`] property.

See g_param_spec_internal() for details on property names.

New in version 2.4.

Gimp.param_spec_path(name, nick, blurb, none_ok, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether no is a valid value.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecPath.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecPath specifying a [type`Path`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_pattern(name, nick, blurb, none_ok, default_value, default_to_context, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether None is a valid value.

  • default_value (Gimp.Pattern or None) – Default pattern.

  • default_to_context (bool) – Whether the context is the context’s pattern.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecPattern.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecPattern specifying a [type`Pattern`] property. See also [func`Gimp`.param_spec_resource].

New in version 3.0.

Gimp.param_spec_resource(name, nick, blurb, resource_type, none_ok, default_value, default_to_context, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • resource_type (GObject.GType) – a GObject.GType, subtype of [class`Gimp`.Resource].

  • none_ok (bool) – Whether None is a valid value.

  • default_value (Gimp.Resource or None) – Default resource.

  • default_to_context (bool) – Whether the context is the context’s resource for the given resource_type.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecResource.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecResource specifying a [type`Resource`] property. See [func`GObject`.ParamSpec.internal] for details on property names.

default_to_context cannot be True for a resource_type of value [class`Gimp`.Resource], but only for specific subtypes. If it is True, default_value must be None. Instead of a fixed default, whatever is the context’s resource for the given type at run time will be used as dynamic default.

New in version 3.0.

Gimp.param_spec_resource_defaults_to_context(pspec)
Parameters:

pspec (GObject.ParamSpec) –

Return type:

bool

Gimp.param_spec_resource_none_allowed(pspec)
Parameters:

pspec (GObject.ParamSpec) –

Return type:

bool

Gimp.param_spec_selection(name, nick, blurb, none_ok, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether no is a valid value.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecSelection.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecSelection specifying a [type`Selection`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_text_layer(name, nick, blurb, none_ok, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • none_ok (bool) – Whether no is a valid value.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecTextLayer.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecTextLayer specifying a [type`TextLayer`] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_unit(name, nick, blurb, allow_pixel, allow_percent, default_value, flags)
Parameters:
  • name (str) – Canonical name of the param

  • nick (str) – Nickname of the param

  • blurb (str) – Brief description of param.

  • allow_pixel (bool) – Whether “pixels” is an allowed unit.

  • allow_percent (bool) – Whether “percent” is an allowed unit.

  • default_value (Gimp.Unit) – Unit to use if none is assigned.

  • flags (GObject.ParamFlags) – a combination of GObject.ParamFlags

Returns:

a newly allocated GObject.ParamSpec instance

Return type:

GObject.ParamSpec

Creates a param spec to hold a units param. See g_param_spec_internal() for more information.

New in version 2.4.

Gimp.param_spec_unit_percent_allowed(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.ParamSpec to hold an Gimp.Unit value.

Returns:

True if the [func`Gimp`.Unit.percent] unit is allowed.

Return type:

bool

New in version 3.0.

Gimp.param_spec_unit_pixel_allowed(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.ParamSpec to hold an Gimp.Unit value.

Returns:

True if the [func`Gimp`.Unit.pixel] unit is allowed.

Return type:

bool

New in version 3.0.

Gimp.param_spec_value_array(name, nick, blurb, element_spec, flags)
Parameters:
  • name (str) – Canonical name of the property specified.

  • nick (str) – Nick name of the property specified.

  • blurb (str) – Description of the property specified.

  • element_spec (GObject.ParamSpec or None) – GObject.ParamSpec the contained array’s elements have comply to, or None.

  • flags (GObject.ParamFlags) – Flags for the property specified.

Returns:

The newly created #GimpParamSpecValueArray.

Return type:

GObject.ParamSpec

Creates a new #GimpParamSpecValueArray specifying a [type`GObject`.ValueArray] property.

See g_param_spec_internal() for details on property names.

New in version 3.0.

Gimp.param_spec_value_array_get_element_spec(pspec)
Parameters:

pspec (GObject.ParamSpec) – a GObject.ParamSpec to hold a #GimpParamSpecValueArray value.

Returns:

param spec for elements of the value array.

Return type:

GObject.ParamSpec

New in version 3.0.

Gimp.patterns_close_popup(pattern_callback)
Parameters:

pattern_callback (str) – The name of the callback registered for this pop-up.

Returns:

True on success.

Return type:

bool

Close the pattern selection dialog.

Closes an open pattern selection dialog.

Gimp.patterns_get_list(filter)
Parameters:

filter (str or None) – An optional regular expression used to filter the list.

Returns:

The list of patterns. The returned value must be freed with GLib.free().

Return type:

[Gimp.Pattern]

Retrieve a complete listing of the available patterns.

This procedure returns a complete listing of available GIMP patterns. Each pattern returned can be used as input to [func`Gimp`.context_set_pattern].

Gimp.patterns_popup(pattern_callback, popup_title, initial_pattern, parent_window)
Parameters:
  • pattern_callback (str) – The callback PDB proc to call when the user chooses a pattern.

  • popup_title (str) – Title of the pattern selection dialog.

  • initial_pattern (Gimp.Pattern or None) – The pattern to set as the initial choice.

  • parent_window (GLib.Bytes or None) – An optional parent window handle for the popup to be set transient to.

Returns:

True on success.

Return type:

bool

Invokes the Gimp pattern selection.

Opens the pattern selection dialog.

Gimp.patterns_refresh()
Returns:

True on success.

Return type:

bool

Refresh current patterns. This function always succeeds.

This procedure retrieves all patterns currently in the user’s pattern path and updates all pattern dialogs accordingly.

Gimp.patterns_set_popup(pattern_callback, pattern)
Parameters:
  • pattern_callback (str) – The name of the callback registered for this pop-up.

  • pattern (Gimp.Pattern) – The pattern to set as selected.

Returns:

True on success.

Return type:

bool

Sets the current pattern in a pattern selection dialog.

Sets the current pattern in a pattern selection dialog.

Gimp.pencil(drawable, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Paint in the current brush without sub-pixel sampling.

This tool is the standard pencil. It draws linearly interpolated lines through the specified stroke coordinates. It operates on the specified drawable in the foreground color with the active brush. The brush mask is treated as though it contains only black and white values. Any value below half is treated as black; any above half, as white.

Gimp.pixbuf_create_buffer(pixbuf)
Parameters:

pixbuf (GdkPixbuf.Pixbuf) – a GdkPixbuf.Pixbuf

Returns:

a new Gegl.Buffer.

Return type:

Gegl.Buffer

Returns a Gegl.Buffer that’s either backed by the pixbuf's pixels, or a copy of them. This function tries to not copy the pixbuf's pixels. If the pixbuf’s rowstride is a multiple of its bpp, a simple reference to the pixbuf's pixels is made and pixbuf will be kept around for as long as the buffer exists; otherwise the pixels are copied.

New in version 2.10.

Gimp.pixbuf_get_format(pixbuf)
Parameters:

pixbuf (GdkPixbuf.Pixbuf) – a GdkPixbuf.Pixbuf

Returns:

the pixbuf's pixel format

Return type:

Babl.Object

Returns the Babl.Object format that corresponds to the pixbuf's pixel format.

New in version 2.10.

Gimp.pixbuf_get_icc_profile(pixbuf)
Parameters:

pixbuf (GdkPixbuf.Pixbuf) – a GdkPixbuf.Pixbuf

Returns:

The ICC profile data, or None. The value should be freed with GLib.free().

Return type:

bytes or None

Returns the ICC profile attached to the pixbuf, or None if there is none.

New in version 2.10.

Gimp.pixels_to_units(pixels, unit, resolution)
Parameters:
  • pixels (float) – value in pixels

  • unit (Gimp.Unit) – unit to convert to

  • resolution (float) – resolution in DPI

Returns:

pixels converted to units.

Return type:

float

Converts a value specified in pixels to unit.

New in version 2.8.

Gimp.pixpipe_params_build(params)
Parameters:

params (Gimp.PixPipeParams) –

Return type:

str

Gimp.pixpipe_params_free(params)
Parameters:

params (Gimp.PixPipeParams) –

Gimp.pixpipe_params_init(params)
Parameters:

params (Gimp.PixPipeParams) –

Gimp.pixpipe_params_parse(parameters, params)
Parameters:
Gimp.progress_cancel(progress_callback)
Parameters:

progress_callback (str) – The name of the callback registered for this progress.

Returns:

True on success.

Return type:

bool

Cancels a running progress.

This function cancels the currently running progress.

New in version 2.2.

Gimp.progress_end()
Returns:

True on success.

Return type:

bool

Ends the progress bar for the current plug-in.

Ends the progress display for the current plug-in. Most plug-ins don’t need to call this, they just exit when the work is done. It is only valid to call this procedure from a plug-in.

New in version 2.4.

Gimp.progress_get_window_handle()
Returns:

The progress bar’s toplevel window’s handle.

Return type:

GLib.Bytes

Returns the native handle of the toplevel window this plug-in’s progress is or would be displayed in.

This function returns the native handle allowing to identify the toplevel window this plug-in’s progress is displayed in. It should still work even if the progress bar has not been initialized yet, unless the plug-in wasn’t called from a GUI. This handle can be of various types (integer, string, etc.) depending on the platform you are running on which is why it returns a GLib.Bytes. There are usually no reasons to call this directly.

New in version 2.2.

Gimp.progress_init(message)
Parameters:

message (str) – Message to use in the progress dialog.

Returns:

True on success.

Return type:

bool

Initializes the progress bar for the current plug-in.

Initializes the progress bar for the current plug-in. It is only valid to call this procedure from a plug-in.

Gimp.progress_install_vtable(vtable, user_data, user_data_destroy)
Parameters:
Returns:

the name of the temporary procedure that’s been installed

Return type:

str

New in version 2.4.

Gimp.progress_pulse()
Returns:

True on success.

Return type:

bool

Pulses the progress bar for the current plug-in.

Updates the progress bar for the current plug-in. It is only valid to call this procedure from a plug-in. Use this function instead of Gimp.progress_update() if you cannot tell how much progress has been made. This usually causes the the progress bar to enter \”activity mode\”, where a block bounces back and forth.

New in version 2.4.

Gimp.progress_set_text(message)
Parameters:

message (str or None) – Message to use in the progress dialog.

Returns:

True on success.

Return type:

bool

Changes the text in the progress bar for the current plug-in.

This function changes the text in the progress bar for the current plug-in. Unlike Gimp.progress_init() it does not change the displayed value.

New in version 2.4.

Gimp.progress_uninstall(progress_callback)
Parameters:

progress_callback (str) – the name of the temporary procedure to uninstall

Uninstalls a temporary progress procedure that was installed using gimp_progress_install().

New in version 2.2.

Gimp.progress_update(percentage)
Parameters:

percentage (float) – Percentage of progress completed (in the range from 0.0 to 1.0).

Returns:

True on success.

Return type:

bool

Updates the progress bar for the current plug-in.

The library will handle over-updating by possibly dropping silently some updates when they happen too close next to each other (either time-wise or step-wise). The caller does not have to take care of this aspect of progression and can focus on computing relevant progression steps.

Gimp.quit()

Forcefully causes the GIMP library to exit and close down its connection to main gimp application. This function never returns.

Gimp.range_estimate_settings(lower, upper)
Parameters:
  • lower (float) – the lower value.

  • upper (float) – the higher value.

Returns:

step:

the proposed step increment.

page:

the proposed page increment.

digits:

the proposed decimal places precision.

Return type:

(step: float, page: float, digits: int)

This function proposes reasonable settings for increments and display digits. These can be used for instance on #GtkRange or other widgets using a #GtkAdjustment typically. Note that it will never return digits with value 0. If you know that your input needs to display integer values, there is no need to set digits.

There is no universal answer to the best increments and number of decimal places. It often depends on context of what the value is meant to represent. This function only tries to provide sensible generic values which can be used when it doesn’t matter too much or for generated GUI for instance. If you know exactly how you want to show and interact with a given range, you don’t have to use this function.

Gimp.rectangle_intersect(x1, y1, width1, height1, x2, y2, width2, height2)
Parameters:
  • x1 (int) – origin of first rectangle

  • y1 (int) – origin of first rectangle

  • width1 (int) – width of first rectangle

  • height1 (int) – height of first rectangle

  • x2 (int) – origin of second rectangle

  • y2 (int) – origin of second rectangle

  • width2 (int) – width of second rectangle

  • height2 (int) – height of second rectangle

Returns:

True if the intersection is non-empty, False otherwise

dest_x:

return location for origin of intersection, or None

dest_y:

return location for origin of intersection, or None

dest_width:

return location for width of intersection, or None

dest_height:

return location for height of intersection, or None

Return type:

(bool, dest_x: int, dest_y: int, dest_width: int, dest_height: int)

Calculates the intersection of two rectangles.

New in version 2.4.

Gimp.rectangle_union(x1, y1, width1, height1, x2, y2, width2, height2)
Parameters:
  • x1 (int) – origin of first rectangle

  • y1 (int) – origin of first rectangle

  • width1 (int) – width of first rectangle

  • height1 (int) – height of first rectangle

  • x2 (int) – origin of second rectangle

  • y2 (int) – origin of second rectangle

  • width2 (int) – width of second rectangle

  • height2 (int) – height of second rectangle

Returns:

dest_x:

return location for origin of union, or None

dest_y:

return location for origin of union, or None

dest_width:

return location for width of union, or None

dest_height:

return location for height of union, or None

Return type:

(dest_x: int, dest_y: int, dest_width: int, dest_height: int)

Calculates the union of two rectangles.

New in version 2.8.

Gimp.show_help_button()
Returns:

the show_help_button boolean

Return type:

bool

Returns whether or not GimpDialog should automatically add a help button if help_func and help_id are given.

This is a constant value given at plug-in configuration time.

New in version 2.2.

Gimp.smudge(drawable, pressure, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • pressure (float) – The pressure of the smudge strokes.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Smudge image with varying pressure.

This tool simulates a smudge using the current brush. High pressure results in a greater smudge of paint while low pressure results in a lesser smudge.

Gimp.smudge_default(drawable, strokes)
Parameters:
  • drawable (Gimp.Drawable) – The affected drawable.

  • strokes ([float]) – Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, …, sn.x, sn.y }.

Returns:

True on success.

Return type:

bool

Smudge image with varying pressure.

This tool simulates a smudge using the current brush. It behaves exactly the same as Gimp.smudge() except that the pressure value is taken from the smudge tool options or the options default if the tools option dialog has not been activated.

Gimp.stack_trace_available(optimal)
Parameters:

optimal (bool) – whether we get optimal traces.

Return type:

bool

Returns True if we have dependencies to generate backtraces. If optimal is True, the function will return True only when we are able to generate optimal traces (i.e. with GDB or LLDB); otherwise we return True even if only backtrace() API is available.

On Win32, we return True if Dr. Mingw is built-in, False otherwise.

Note: this function is not crash-safe, i.e. you should not try to use it in a callback when the program is already crashing. In such a case, call Gimp.stack_trace_print() or Gimp.stack_trace_query() directly.

New in version 2.10.

Gimp.stack_trace_print(prog_name, stream)
Parameters:
  • prog_name (str) – the program to attach to.

  • stream (object or None) – a FILE* stream.

Returns:

True if a stack trace could be generated, False otherwise.

trace:

location to store a newly allocated string of the trace.

Return type:

(bool, trace: str)

Attempts to generate a stack trace at current code position in prog_name. prog_name is mostly a helper and can be set to None. Nevertheless if set, it has to be the current program name (argv[0]). This function is not meant to generate stack trace for third-party programs, and will attach the current process id only. Internally, this function uses gdb or lldb if they are available, or the stacktrace() API on platforms where it is available. It always fails on Win32.

The stack trace, once generated, will either be printed to stream or returned as a newly allocated string in trace, if not None.

In some error cases (e.g. segmentation fault), trying to allocate more memory will trigger more segmentation faults and therefore loop our error handling (which is just wrong). Therefore printing to a file description is an implementation without any memory allocation.

New in version 2.10.

Gimp.stack_trace_query(prog_name)
Parameters:

prog_name (str) – the program to attach to.

This is mostly the same as GLib.on_error_query() except that we use our own backtrace function, much more complete. prog_name must be the current program name (argv[0]). It does nothing on Win32.

New in version 2.10.

Gimp.strip_uline(str)
Parameters:

str (str or None) – underline infested string (or None)

Returns:

A (possibly stripped) copy of str which should be freed using GLib.free() when it is not needed any longer.

Return type:

str

This function returns a copy of str stripped of underline characters. This comes in handy when needing to strip mnemonics from menu paths etc.

In some languages, mnemonics are handled by adding the mnemonic character in brackets (like “File (_F)”). This function recognizes this construct and removes the whole bracket construction to get rid of the mnemonic (see bug 157561).

Gimp.sysconf_directory()
Returns:

The top directory for GIMP config files.

Return type:

str

Returns the top directory for GIMP config files. If the environment variable GIMP3_SYSCONFDIR exists, that is used. It should be an absolute pathname. Otherwise, on Unix the compile-time defined directory is used. On Windows, the installation directory as deduced from the executable’s full filename is used.

In config files such as gimprc, the string ${gimp_sysconf_dir} expands to this directory.

The returned string is owned by GIMP and must not be modified or freed. The returned string is in the encoding used for filenames by GLib, which isn’t necessarily UTF-8. (On Windows it always is UTF-8.).

Gimp.temp_directory()
Returns:

The default top directory for GIMP temporary files.

Return type:

str

Returns the default top directory for GIMP temporary files. If the environment variable GIMP3_TEMPDIR exists, that is used. It should be an absolute pathname. Otherwise, a subdirectory of the directory returned by GLib.get_tmp_dir() is used.

In config files such as gimprc, the string ${gimp_temp_dir} expands to this directory.

Note that the actual directories used for GIMP temporary files can be overridden by the user in the preferences dialog.

The returned string is owned by GIMP and must not be modified or freed. The returned string is in the encoding used for filenames by GLib, which isn’t necessarily UTF-8. (On Windows it always is UTF-8.).

New in version 2.10.10.

Gimp.temp_file(extension)
Parameters:

extension (str or None) – The extension the file will have.

Returns:

The new temp file.

Return type:

Gio.File

Generates a unique temporary file.

Generates a unique file using the temp path supplied in the user’s gimprc.

Gimp.text_font(image, drawable, x, y, text, border, antialias, size, font)
Parameters:
  • image (Gimp.Image) – The image.

  • drawable (Gimp.Drawable or None) – The affected drawable: (None for a new text layer).

  • x (float) – The x coordinate for the left of the text bounding box.

  • y (float) – The y coordinate for the top of the text bounding box.

  • text (str) – The text to generate (in UTF-8 encoding).

  • border (int) – The size of the border.

  • antialias (bool) – Antialiasing.

  • size (float) – The size of text in pixels.

  • font (Gimp.Font) – The font.

Returns:

The new text layer or None if no layer was created.

Return type:

Gimp.Layer or None

Add text at the specified location as a floating selection or a new layer.

The x and y parameters together control the placement of the new text by specifying the upper left corner of the text bounding box. If the specified drawable parameter is valid, the text will be created as a floating selection attached to the drawable. If the drawable parameter is not valid (None), the text will appear as a new layer. Finally, a border can be specified around the final rendered text. The border is measured in pixels. The size is always in pixels. If you need to display a font in points, divide the size in points by 72.0 and multiply it by the image’s vertical resolution.

Gimp.text_get_extents_font(text, size, font)
Parameters:
  • text (str) – The text to generate (in UTF-8 encoding).

  • size (float) – The size of text in either pixels or points.

  • font (Gimp.Font) – The name of the font.

Returns:

True on success.

width:

The width of the glyph extents.

height:

The height of the glyph extents.

ascent:

The ascent of the glyph extents.

descent:

The descent of the glyph extents.

Return type:

(bool, width: int, height: int, ascent: int, descent: int)

Get extents of the bounding box for the specified text.

This tool returns the width and height of a bounding box for the specified text rendered with the specified font information. Ascent and descent of the glyph extents are returned as well. The ascent is the distance from the baseline to the highest point of the character. This is positive if the glyph ascends above the baseline. The descent is the distance from the baseline to the lowest point of the character. This is positive if the glyph descends below the baseline. The size is always in pixels. If you need to set a font in points, divide the size in points by 72.0 and multiply it by the vertical resolution of the image you are taking into account.

Gimp.tile_height()
Returns:

the tile_height

Return type:

int

Returns the tile height GIMP is using.

This is a constant value given at plug-in configuration time.

Gimp.tile_width()
Returns:

the tile_width

Return type:

int

Returns the tile width GIMP is using.

This is a constant value given at plug-in configuration time.

Gimp.type_get_translation_context(type)
Parameters:

type (GObject.GType) – a GObject.GType

Returns:

the translation context associated with type or None if no context was set

Return type:

str

Retrieves the translation context that has been previously set using Gimp.type_set_translation_context(). You should not need to use this function directly, use Gimp.enum_get_value() or Gimp.enum_value_get_desc() instead.

New in version 2.8.

Gimp.type_get_translation_domain(type)
Parameters:

type (GObject.GType) – a GObject.GType

Returns:

the translation domain associated with type or None if no domain was set

Return type:

str

Retrieves the gettext translation domain identifier that has been previously set using Gimp.type_set_translation_domain(). You should not need to use this function directly, use Gimp.enum_get_value() or Gimp.enum_value_get_desc() instead.

New in version 2.2.

Gimp.type_set_translation_context(type, context)
Parameters:

This function attaches a constant string as a translation context to a GObject.GType. The only purpose of this function is to use it when registering a GObject.TYPE_ENUM with translatable value names.

New in version 2.8.

Gimp.type_set_translation_domain(type, domain)
Parameters:

This function attaches a constant string as a gettext translation domain identifier to a GObject.GType. The only purpose of this function is to use it when registering a GObject.TYPE_ENUM with translatable value names.

New in version 2.2.

Gimp.units_to_pixels(value, unit, resolution)
Parameters:
  • value (float) – value in units

  • unit (Gimp.Unit) – unit of value

  • resolution (float) – resloution in DPI

Returns:

value converted to pixels.

Return type:

float

Converts a value specified in unit to pixels.

New in version 2.8.

Gimp.units_to_points(value, unit, resolution)
Parameters:
  • value (float) – value in units

  • unit (Gimp.Unit) – unit of value

  • resolution (float) – resloution in DPI

Returns:

value converted to points.

Return type:

float

Converts a value specified in unit to points.

New in version 2.8.

Gimp.user_time()
Returns:

timestamp for plug-in window

Return type:

int

Returns the timestamp of the user interaction that should be set on the plug-in window. This is handled transparently, plug-in authors do not have to care about it.

This is a constant value given at plug-in configuration time.

New in version 2.6.

Gimp.utf8_strtrim(str, max_chars)
Parameters:
  • str (str or None) – an UTF-8 encoded string (or None)

  • max_chars (int) – the maximum number of characters before the string get trimmed

Returns:

A (possibly trimmed) copy of str which should be freed using GLib.free() when it is not needed any longer.

Return type:

str

Creates a (possibly trimmed) copy of str. The string is cut if it exceeds max_chars characters or on the first newline. The fact that the string was trimmed is indicated by appending an ellipsis.

Gimp.value_dup_double_array(value)
Parameters:

value (GObject.Value) – A valid value of type %GIMP_TYPE_DOUBLE_ARRAY

Returns:

The contents of value

Return type:

[float]

Gets the contents of a %GIMP_TYPE_DOUBLE_ARRAY GObject.Value

Gimp.value_dup_int32_array(value)
Parameters:

value (GObject.Value) – A valid value of type %GIMP_TYPE_INT32_ARRAY

Returns:

The contents of value

Return type:

[int]

Gets the contents of a %GIMP_TYPE_INT32_ARRAY GObject.Value

Gimp.value_get_double_array(value)
Parameters:

value (GObject.Value) – A valid value of type %GIMP_TYPE_DOUBLE_ARRAY

Returns:

The contents of value

Return type:

[float]

Gets the contents of a %GIMP_TYPE_DOUBLE_ARRAY GObject.Value

Gimp.value_get_int32_array(value)
Parameters:

value (GObject.Value) – A valid value of type %GIMP_TYPE_INT32_ARRAY

Returns:

The contents of value

Return type:

[int]

Gets the contents of a %GIMP_TYPE_INT32_ARRAY GObject.Value

Gimp.value_set_double_array(value, data)
Parameters:

Sets the contents of value to data.

Gimp.value_set_int32_array(value, data)
Parameters:
  • value (GObject.Value) – A valid value of type %GIMP_TYPE_INT32_ARRAY

  • data ([int]) – A #gint32 array

Sets the contents of value to data.

Gimp.value_set_static_double_array(value, data)
Parameters:

Sets the contents of value to data, without copying the data.

Gimp.value_set_static_int32_array(value, data)
Parameters:
  • value (GObject.Value) – A valid value of type %GIMP_TYPE_INT32_ARRAY

  • data ([int]) – A #gint32 array

Sets the contents of value to data, without copying the data.

Gimp.value_take_double_array(value, data)
Parameters:

Sets the contents of value to data, and takes ownership of data.

Gimp.value_take_int32_array(value, data)
Parameters:
  • value (GObject.Value) – A valid value of type %GIMP_TYPE_int32_ARRAY

  • data ([int]) – A #gint32 array

Sets the contents of value to data, and takes ownership of data.

Gimp.vector2_add(vector1, vector2)
Parameters:
Returns:

destination for the resulting Gimp.Vector2.

Return type:

result: Gimp.Vector2

Computes the sum of two 2D vectors. The resulting Gimp.Vector2 is stored in result.

Gimp.vector2_sub(vector1, vector2)
Parameters:
Returns:

the destination for the resulting Gimp.Vector2.

Return type:

result: Gimp.Vector2

Computes the difference of two 2D vectors (vector1 minus vector2). The resulting Gimp.Vector2 is stored in result.

Gimp.vector3_add(vector1, vector2)
Parameters:
Returns:

destination for the resulting Gimp.Vector3.

Return type:

result: Gimp.Vector3

Computes the sum of two 3D vectors. The resulting Gimp.Vector3 is stored in result.

Gimp.vector3_sub(vector1, vector2)
Parameters:
Returns:

the destination for the resulting Gimp.Vector3.

Return type:

result: Gimp.Vector3

Computes the difference of two 3D vectors (vector1 minus vector2). The resulting Gimp.Vector3 is stored in result.

Gimp.vector_2d_to_3d(sx, sy, w, h, x, y, vp, p)
Parameters:
  • sx (int) – the abscissa of the upper-left screen rectangle.

  • sy (int) – the ordinate of the upper-left screen rectangle.

  • w (int) – the width of the screen rectangle.

  • h (int) – the height of the screen rectangle.

  • x (int) – the abscissa of the point in the screen rectangle to map.

  • y (int) – the ordinate of the point in the screen rectangle to map.

  • vp (Gimp.Vector3) – the position of the observer.

  • p (Gimp.Vector3) – the resulting point.

\”Compute screen (sx, sy) - (sx + w, sy + h) to 3D unit square mapping. The plane to map to is given in the z field of p. The observer is located at position vp (vp->z != 0.0).\”

In other words, this computes the projection of the point (x, y) to the plane z = p->z (parallel to XY), from the vp point of view through the screen (sx, sy)->(sx + w, sy + h)

Gimp.vector_2d_to_3d_val(sx, sy, w, h, x, y, vp, p)
Parameters:
  • sx (int) – the abscissa of the upper-left screen rectangle.

  • sy (int) – the ordinate of the upper-left screen rectangle.

  • w (int) – the width of the screen rectangle.

  • h (int) – the height of the screen rectangle.

  • x (int) – the abscissa of the point in the screen rectangle to map.

  • y (int) – the ordinate of the point in the screen rectangle to map.

  • vp (Gimp.Vector3) – position of the observer.

  • p (Gimp.Vector3) – the resulting point.

Returns:

the computed Gimp.Vector3 point.

Return type:

Gimp.Vector3

This function is identical to Gimp.vector_2d_to_3d() but the position of the observer and the resulting point p are passed by value rather than by reference.

Gimp.vector_3d_to_2d(sx, sy, w, h, vp, p)
Parameters:
  • sx (int) – the abscissa of the upper-left screen rectangle.

  • sy (int) – the ordinate of the upper-left screen rectangle.

  • w (int) – the width of the screen rectangle.

  • h (int) – the height of the screen rectangle.

  • vp (Gimp.Vector3) – position of the observer.

  • p (Gimp.Vector3) – the 3D point to project to the plane.

Returns:

x:

the abscissa of the point in the screen rectangle to map.

y:

the ordinate of the point in the screen rectangle to map.

Return type:

(x: float, y: float)

Convert the given 3D point to 2D (project it onto the viewing plane, (sx, sy, 0) - (sx + w, sy + h, 0). The input is assumed to be in the unit square (0, 0, z) - (1, 1, z). The viewpoint of the observer is passed in vp.

This is basically the opposite of Gimp.vector_2d_to_3d().

Gimp.version()
Returns:

GIMP version number. The returned value must be freed with GLib.free().

Return type:

str

Returns the host GIMP version.

This procedure returns the version number of the currently running GIMP.

Gimp.wm_class()
Returns:

the window manager class

Return type:

str

Returns the window manager class to be used for plug-in windows.

This is a constant value given at plug-in configuration time.