I've been 3 days searching for documentation about python-fu for GIMP 2.8, and the one I find is great, but deprecated.

So I'm now stuck at this place: I've created 3 color channels, and want to add each one of them as a mask to each of 3 layers.

What I've done till now: (manually load the image, and create 3 color channels for lights, middle tones and shadows);

Get it's ID, with:

ima = gimp.image_list()[0]

Get the layer ID and duplicate the layer 3 times:

layn = pdb.gimp_layer_new_from_visible(ima, ima, 'dup')
pdb.gimp_image_insert_layer(ima, layn, None, -1) 

Now I have an image with three layers and want to add a layer mask to each of the 3 layers but from the 3 different color channels... but I don't know how.

1 Answer 1


The API doesn't seem to support creating a mask directly from a random channel. But you can create a mask from the selection, so:

  1. Copy your channel into the selection

  2. Create the mask

  3. Add the mask to the layer:

  • 1
    Of course, but here the question is to create a layer mask, not a layer.
    – xenoid
    Aug 28, 2017 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.