An "Alpha" layer blending mode - need help with building - 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) +--- Thread: An "Alpha" layer blending mode - need help with building (/Thread-An-Alpha-layer-blending-mode-need-help-with-building) |
An "Alpha" layer blending mode - need help with building - Ismir Egal - 04-09-2022 Hello guys, Similar to "HSV Hue", "HSV Saturation" and "HSV Value" i want to implement an "Alpha" layer blending mode which replaces the target alpha channel with the one of the input layer. I'm not big into programming so luckily i can just use one of the aforementioned ones as a base. The color space transformations aren't required and we don't need to do any math so the code should just be: operations/layer-modes/gimpoperationlayermode-blend.c (line 538): Code: void Code: void gimp_operation_layer_mode_blend_hsv_value (const gfloat *in, operations/layer-modes/gimp-layer-modes(line 584) Code: { GIMP_LAYER_MODE_ALPHA, However, i can't get Gimp to build. Not that it fails; it's that the problem sits in front of the desk. The tools don't link up and the libraries don't seem to work. I've already spent way more time into setting this up then coming up with the code seen above. Personally i don't think it's worth putting more time into trying to make the building work so Could somebody implement these changes and upload a Windows build? (if it even works that way) Setting this up as a plug-in would obviously be the better way but i have no idea how to do this, especially since i can't just copy and modify existing functions. Please let me know if you can help or know a better solution RE: An "Alpha" layer blending mode - need help with building - tmanni - 04-09-2022 Quote:i want to implement an "Alpha" layer blending mode which replaces the target alpha channel with the one of the input layer A blending mode is, in my opinion, a bad choice. A plug-in, or better, a GEGL operation will do the job. Since you read C code, you could be able to do it. Start here to understand how gimp filters are implemented in GEGL: https://gitlab.gnome.org/GNOME/gegl/-/tree/master/operations/common-gpl3%2B Ask your questions on the gimp-developer mailing list gimp-developer-list@gnome.org or better on IRC: irc.gimp.org channels #gimp or #gegl RE: An "Alpha" layer blending mode - need help with building - rich2005 - 04-10-2022 Just a thought, using layer masks for the transparency. This old plug-in create-layer-mask-from.py might be the basis for improvement. Looks like this 40 second demo https://i.imgur.com/513j34U.mp4 I can not remember where the script comes from, probably the now defunct plugin-registry, so zipped and attached. RE: An "Alpha" layer blending mode - need help with building - Ofnuts - 04-10-2022 " i want to implement an "Alpha" layer blending mode which replaces the target alpha channel with the one of the input layer. " Looks like the "ClipToBackDrop" setting: [attachment=7756]
With an opacity reversal, there is also the "Erase" blending mode: [attachment=7757]
RE: An "Alpha" layer blending mode - need help with building - Ismir Egal - 04-11-2022 Thanks for the support - I should've probably given more background here. I have to apply the operation on two sets of 180 images, for which i'm using the plugin "interleave layers" and "export layers" (which i guess are actually made by you, @Ofnuts) That's the reason why i was so keen on making it a layer mode. (04-10-2022, 08:48 AM)rich2005 Wrote: Just a thought, using layer masks for the transparency. This old plug-in create-layer-mask-from.py might be the basis for improvement.Definitely beats manually extracting the alpha channel from one image and applying it the the other. It's gonna be hard managing the input for a series of pictures, though. (04-10-2022, 12:33 PM)Ofnuts Wrote: "Looks like the "ClipToBackDrop" setting: .."That works perfectly! Now i just need a way to set the composition mode of many layers at once. An easy option would be setting it in your interleaving script, during the copyLayers action. It should be something like Code: base.preserve_transparency=True Both obviously don't work, but i can't find the name of the property i need here - the python documentation is older than i am. RE: An "Alpha" layer blending mode - need help with building - tmanni - 04-11-2022 Something like Code: pdb.gimp_layer_set_composite_mode(layer, GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP) RE: An "Alpha" layer blending mode - need help with building - Ofnuts - 04-11-2022 tmanniSomething like Code: pdb.gimp_layer_set_composite_mode(layer, GIMP_LAYER_COMPOSITE_CLIP_TO_BACKDROP) Will look into adding that to interleave layers, if I can find a uses cases where this can be helpful. RE: An "Alpha" layer blending mode - need help with building - Ismir Egal - 04-12-2022 It works! https://imgur.com/a/yUTHuC1 Thanks for the help. (04-11-2022, 11:58 AM)Ofnuts Wrote: Will look into adding that to interleave layers, if I can find a uses cases where this can be helpful. I don't think there are many - even this right here is already way too specific |