r/GIMP • • 2d ago

Recent changes to the Python API in GIMP 3.2?

Does anyone know whether one of the recent updates to GIMP changed some functionality of the Python API (possibly the update to 3.2.6 or earlier)?

My specific problem concerns selecting the alpha of a layer and then copying from another layer with this selection. Here is the command flow of what I am doing:

pattern_layer = image.get_layer_by_name("pattern_layer")
image.select_item(Gimp.ChannelOps.REPLACE, pattern_layer) #select alpha
source_layer = image.get_layer_by_name("source_layer")
Gimp.edit_copy([source_layer]) #copy the selection from source layer
target_layer = image.get_layer_by_name("target_layer")
pasted_layers = Gimp.edit_paste(target_layer, False) #paste to target layer
Gimp.floating_sel_anchor(pasted_layers[0])

In previous GIMP versions, this would make an exact selection of the alpha of the "pattern_layer", then copy exactly according to this selection from the "source_layer" and paste it to the "target_layer".

In the most recent version, it still selects the alpha of the pattern_layer but when actually copying from the source_layer, it makes an additional rectangle around the selection and then copies the rectangle instead. (But what I need is copying the alpha-selection, not the rectangle around it.)

Does anyone know something about this new mechanism and when the GIMP devs have changed it? Would help me a lot! Many thanks!

Edit: I just downgraded my GIMP to 3.2.4 and my above code works again (without copying the additional rectangle). So they changed smth about the above python commands in the transition from 3.2.4 to 3.2.6. Would still be cool if someone knows of any exact documentation of the Python API changes or whether this new behavior is intended or rather a bug.

4 Upvotes

2 comments sorted by

5

u/Stratelier 2d ago

1

u/razabbb 3h ago

Thanks for the info and the link!