Update Python-fu-removebg.py with correct mask

This commit is contained in:
Maniu
2024-11-08 21:31:18 +01:00
committed by GitHub
parent 588c4c194d
commit 26a8c92f4f

View File

@@ -137,13 +137,13 @@ class PythonRemoveBG(Gimp.PlugIn):
image.insert_layer(newlayer, None,-1)
if asMask:
pdb.gimp_image_select_item(image, CHANNEL_OP_REPLACE, newlayer)
image.select_item(Gimp.ChannelOps.REPLACE, newlayer)
image.remove_layer(newlayer)
copyLayer = pdb.gimp_layer_copy(curLayer, TRUE)
image.add_layer(copyLayer, -1)
copyLayer = Gimp.layer_copy(curLayer)
image.insert_layer(copyLayer,None, -1)
mask = copyLayer.create_mask(ADD_SELECTION_MASK)
copyLayer.add_mask(mask)
pdb.gimp_selection_none(image)
Gimp.selection_none(image)
image.undo_group_end()
Gimp.displays_flush()