It looks like plug-in-unsharp-mask by Winston Chang has been removed in favour of a script-fu-unsharp-mask.
But the script-fu does not work as the plug-in.
I cannot see how its result sharpens an image.
My result for example is this:
I want that egg-shape sharpened, which worked fine from a script with the plug-in.
Now I get something I do not know what to do with.
The transparent background is gone … it’s not sharpened.
I’m clueless with such a result.
So what’s the proper way to sharpen things from a python script?
Just bring that Winston Chang plug-in back, please.
You could have left the working one ( until there is a better solution)
and remove the one that produces a useless result.
I still can’t see how this script-fu thing sharpens an image.
It removes my transparent background and produces layers … for what?
Does Filters > Enhance > Sharpen (Unsharp Mask) (mentioned in the comments in that commit, as an alternative to the removed plugin) not work for you? On my F41 system running GIMP 2.99.19, it appears to offer an interactive parameter interface with live preview, and doesn’t remove my image’s alpha layer when applied.
(Edit: Oh, sorry, never mind. You wanted something scriptable. My mistake.)
I didn’t make the decision, but the reason was that if we left those functions in for 3.0, then we’d have to support it until GIMP 4 comes out. So there would be conflicts with the old limited way and the new flexible method.
Running the Script-Fu version on an image, I see that the extra layers serve to sharpen the image - if I toggle them off, the image becomes blurrier again. It’s not as nice as the GEGL operation though.
Finally found the solution by copying from goat-exercise.
This is the gegl code I needed:
gegl:unsharp-mask
std-dev=3
scale=0.5
threshold=0
Now at the place in my code where the old unsharp-mask plugin was removed I put this:
intersect, x, y, width, height = easteregg_lay.mask_intersect()
if intersect:
Gegl.init(None)
buffer = easteregg_lay.get_buffer()
shadow_buffer = easteregg_lay.get_shadow_buffer()
graph = Gegl.Node()
in_put = graph.create_child("gegl:buffer-source")
in_put.set_property("buffer", buffer)
unsharp = graph.create_child("gegl:unsharp-mask")
unsharp.set_property("std-dev", 3)
unsharp.set_property("scale", 0.5)
unsharp.set_property("threshold", 0)
output = graph.create_child("gegl:write-buffer")
output.set_property("buffer", shadow_buffer)
in_put.link(unsharp)
unsharp.link(output)
output.process()
# This is extremely important in bindings, since we don't
# unref buffers. If we don't explicitly flush a buffer, we
# may left hanging forever. This step is usually done
# during an unref().
shadow_buffer.flush()
easteregg_lay.merge_shadow(True)
easteregg_lay.update(x, y, width, height)
easteregg_lay is my layer in question.
Maybe this helps others struggling with similar problems.
PS.: “input” was replaced by “in_put” because
PyCharm said "shadows built-in name ‘input’ ".
So I thought it’s better to use something else.
Where does one find the list of available Gegl ops (lens-distortion here) and the description of the parameters? And can this be retrieved dynamically?
Edit: Answer: Gegl.list_operations(), now, for the parameters…
I am pursuing the same goal I think. I am managing to replace some of the pdb plugins that have disappeared with functions that contain Gegl code. For example hsv-noise