Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to work with effects in GIMP Python?
#1
In GIMP 2 you could threshold the alpha channel (Layer > Transparency > Threshold Alpha...), in Python console equivalent was:

Code:
image = gimp.image_list()[0]
layer = image.layers[0]
# image,layer,threshold.
pdb.plug_in_threshold_alpha(image,layer,0)

In GIMP 3 Threshold Alpha has become a filter ("fx" icon next to the layer)
I can do in GIMP 3:

Code:
image = Gimp.get_images()[0]
layer = image.get_selected_layers()[0]
# Add Threshold Alpha layer fx (Layer > Transparency > Threshold Alpha...).
filter1 = Gimp.DrawableFilter.new(layer, 'gimp:threshold-alpha', 'My Threshold Alpha')
# Add Gaussian Blur layer fx (Filters > Blur > Gaussian Blur...).
filter2 = Gimp.DrawableFilter.new(layer, 'gegl:gaussian-blur', 'My Gaussian Blur')
layer.append_filter(filter1)
layer.append_filter(filter2)
But this does the filters in default settings.
How do I change the settings of the filters, for example how do i set the alpha value to 0 of 'My Threshold Alpha'?
   
Reply


Messages In This Thread
How to work with effects in GIMP Python? - by joeyeroq - 04-02-2025, 09:32 PM

Forum Jump: