Trouble replicating posterize with blending option enabled in python-fu script - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: Trouble replicating posterize with blending option enabled in python-fu script (/Thread-Trouble-replicating-posterize-with-blending-option-enabled-in-python-fu-script) |
Trouble replicating posterize with blending option enabled in python-fu script - Error - 06-16-2022 Hello! I've recently started scripting with gimp and I've ran into a problem with posterize. I believe the issue is with how I am trying to implement the blending option. Does anyone have experience with automating the posturize tool with a blending option enabled? I've found: gimp_edit_blend() gimp_context_set_paint_mode() gimp_layer_set_mode() Removed Alpha layer, manually using the posterize tool with 2 levels an color erase blending With my tool set to 2 levels using gimp_edit_blend Code: srclayer = image.layers[0] It's quite possible I'm completely missing how the posterize tool accomplishes the blending. So far the results I've been getting are as if I had no blending mode selected (Replace/Normal). I'm aiming to use the Color Erase paint mode, but I'm running out of ideas what I'm doing wrong. Thank you for reading. RE: Trouble replicating posterize with blending option enabled in python-fu script - Ofnuts - 06-16-2022 As far as I can tell, using something other than Replace is the same as using Replace on a copy of the layer, and putting this over a copy of the initial layer using the required paint mode. For Color erase you have to fill the alpha layer to 100% in addition. [attachment=8128]
RE: Trouble replicating posterize with blending option enabled in python-fu script - rich2005 - 06-17-2022 I think this is not only a scripting issue but a GEGL issue. The Gimp 2.10 posterize in the pdb is essentially GEGL with a backward compatibility 'wrapper'. A demo here using the Filters -> Generic -> GEGL graph, it is the posterize filter with blending mode. [attachment=8129] Unfortunately in keeping with the old (Gimp 2.8) posterize there is no way of applying the GEGL blend modes. Also they are not replicated in the layer modes although you can get an "effect" by adding some other procedure (maybe). RE: Trouble replicating posterize with blending option enabled in python-fu script - Error - 06-17-2022 Thank you Ofnuts for getting me on the right track! The issue was that I didn't make the alpha mask opaque. My code for replicating color-erase posterize is below: Code: groupLayer = pdb.gimp_layer_group_new(image) |