GIMP Developer Site now have improved navigation!
Useful Modules/Classes in GIMP 3.0+

Useful Modules/Classes in GIMP 3.0+

Here’s a guide to the modules you’re likely to need.

It’s a work in progress: feel free to add to it.

Online documentation for our libraries can be found at the 3.0 API reference page.

You can also get some information in GIMP’s Python console with help(module) or help(object), and you can get a list of functions with dir(object).

Gimp

The base module: almost everything is under Gimp.

Gimp.Image

The image object.

Some operations that used to be PDB calls, like

Python2
pdb.gimp_selection_layer_alpha(layer)

are now in the Image object, e.g.

Python3
img.select_item(Gimp.ChannelOps.REPLACE, layer)

Gimp.Layer

The layer object.

Python3
fog = Gimp.Layer.new(image, name,
                     drawable.width(), drawable.height(), type, opacity,
                     Gimp.LayerMode.NORMAL)

Gimp.Selection

Selection operations that used to be in the PDB, e.g.

Python2
pdb.gimp_selection_none(img)

are now in the Gimp.Selection module, e.g.

Python3
Gimp.Selection.none(img)

Gimp.ImageType

A home for image types like RGBA, GRAY, etc:

Python3
Gimp.ImageType.RGBA_IMAGE

Gimp.FillType

e.g. Gimp.FillType.TRANSPARENT, Gimp.FillType.BACKGROUND

Gimp.ChannelOps

The old channel op definitions in the gimpfu module, like

Python2
CHANNEL_OP_REPLACE

are now in their own module:

Python3
Gimp.ChannelOps.REPLACE

Gegl.Color

In legacy plug-ins you could pass a simple list of integers, like (0, 0, 0). In 3.0+, create a Gegl.Color object:

Python3
c = Gegl.Color.new("black")
c.set_rgba(0.94, 0.71, 0.27, 1.0)
Last updated on