Update python-fu-removebg.py

fix mask part
This commit is contained in:
Maniu
2025-05-25 21:50:49 +02:00
committed by GitHub
parent aaae139e3a
commit 7b782fe37d

View File

@@ -149,12 +149,12 @@ class PythonRemoveBG(Gimp.PlugIn):
if asMask: if asMask:
image.select_item(Gimp.ChannelOps.REPLACE, newlayer) image.select_item(Gimp.ChannelOps.REPLACE, newlayer)
copyLayer = newlayer.copy()
image.remove_layer(newlayer) image.remove_layer(newlayer)
copyLayer = Gimp.layer_copy(curLayer)
image.insert_layer(copyLayer,None, -1) image.insert_layer(copyLayer,None, -1)
mask = copyLayer.create_mask(ADD_SELECTION_MASK) mask = copyLayer.create_mask(Gimp.AddMaskType.SELECTION)
copyLayer.add_mask(mask) copyLayer.add_mask(mask)
Gimp.selection_none(image) image.get_selection().none(image)
image.undo_group_end() image.undo_group_end()
Gimp.displays_flush() Gimp.displays_flush()