It is currently Mon Jul 08, 2024 5:25 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: GEGL selection modification filter to apply on layer mask
PostPosted: Wed Feb 07, 2024 8:40 pm  (#1) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1458
This Plugin is now released

https://github.com/LinuxBeaver/Gimp_Lay ... n/releases


Post from development day below

I plan on making a GEGL plugin that runs on layer mask, quick mask and erase fills that uses the following options to modify selections.

Distort, Grow/Shrink and Feather

Here is how it will work.

1. "Feather" is median blur and gaussian blur on a selection mask.
2. "Grow and Shrink" is median blur alone on a selection mask
3. "Distort" can be done with noise spread, median blur and gaussian blur on a selection mask

GEGL can run filters on quick mask, layer mask and erase blend mode fills and that is how it will work.
Attachment:
2024-02-07_18-09.png
2024-02-07_18-09.png [ 508.23 KiB | Viewed 412 times ]


Last edited by contrast_ on Thu Feb 08, 2024 9:00 pm, edited 5 times in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: GEGL Selection mask with live preview (coming soon)
PostPosted: Wed Feb 07, 2024 8:41 pm  (#2) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 13071
Location: Native to NYC living in Arizona, Gimp 2.8 & 2.10, Win 11 PC.
contrast_ wrote:
I plan on making a GEGL plugin that runs on layer mask, quick mask and erase fills that uses the following options to modify selections.

Distort, Grow/Shrink and Feather

Here is how it will work.

1. "Feather" is median blur and gaussian blur on a selection mask.
2. "Grow and Shrink" is median blur alone on a selection mask
3. "Distort" can be done with noise spread, median blur and gaussian blur on a selection mask

GEGL can run filters on quick mask, layer mask and erase blend mode fills and that is how it will work.
Attachment:
2024-02-07_18-09.png

That looks really nice!

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: GEGL Selection mask with live preview (coming soon)
PostPosted: Wed Feb 07, 2024 10:56 pm  (#3) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1458
It's pretty much done. All I need to do is give it a shorter title. btw this is one of the most simple plugins I publicly released. It is literally just three nodes (noise spread, median blur, and gaussian blur)
Attachment:
working.png
working.png [ 420.6 KiB | Viewed 396 times ]


Top
 Post subject: Re: GEGL Selection mask with live preview (coming soon)
PostPosted: Wed Feb 07, 2024 11:06 pm  (#4) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 13071
Location: Native to NYC living in Arizona, Gimp 2.8 & 2.10, Win 11 PC.
contrast_ wrote:
It's pretty much done. All I need to do is give it a shorter title. btw this is one of the most simple plugins I publicly released. It is literally just three nodes (noise spread, median blur, and gaussian blur)
Attachment:
working.png

Simple is nice too.
:hehe

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: GEGL Selection mask with live preview (coming soon)
PostPosted: Thu Feb 08, 2024 12:01 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1458
Its done and it was renamed to "modify selection" I'll upload it on Github and provide binaries tomorrow but right now I'll link the source code for technical people to compile.

Attachment:
gegl_selection_mask.png
gegl_selection_mask.png [ 432.65 KiB | Viewed 393 times ]




If you figure out how to compile the code below and put the binary in

Windows

C:\Users\(USERNAME)\AppData\Local\gegl-0.4\plug-ins

Linux

/home/(USERNAME)/.local/share/gegl-0.4/plug-ins

Linux (Flatpak includes Chromebook)

/home/(USERNAME)/.var/app/org.gimp.GIMP/data/gegl-0.4/plug-ins

You'll have the filter I have. If not you'll have to wait several hours. lol

/* This file is an image processing operation for GEGL
*
* GEGL is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* GEGL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GEGL; if not, see <https://www.gnu.org/licenses/>.
*
* Copyright 2006 Øyvind Kolås <pippin@gimp.org>
* 2024 Beaver GEGL Grow Shrink Feather (GEGL Selection Mask modifier).

You can test this filter by pasting this code into GEGL Graph (ITS VERY SIMPLE)
noise-spread amount-x=0 amount-y=0
median-blur radius=0 alpha-percentile=100
gaussian-blur std-dev-x=0 std-dev-y=0
*/

#include "config.h"
#include <glib/gi18n-lib.h>

#ifdef GEGL_PROPERTIES

property_double (feather, _("Gaussian Blur to Feather selection"), 0)
   description (_("Gaussian Blur will feather the selection when used appropriately with median blur."))
   value_range (0.0, 20.0)
   ui_range    (0.24, 20.0)
   ui_gamma    (3.0)

enum_start (gegl_gimplayershadow_grow_shape2)
  enum_value (GEGL_DROPSHADOW_GROW_SHAPE_SQUARE,  "square",  N_("Square"))
  enum_value (GEGL_DROPSHADOW_GROW_SHAPE_CIRCLE,  "circle",  N_("Circle"))
  enum_value (GEGL_DROPSHADOW_GROW_SHAPE_DIAMOND, "diamond", N_("Diamond"))
enum_end (GeglgimplayershadowGrowShape2)


property_enum   (growshrinkshape, _("Grow to Shrink base shape"),
                 GeglgimplayershadowGrowShape2, gegl_gimplayershadow_grow_shape2,
                 GEGL_DROPSHADOW_GROW_SHAPE_CIRCLE)
  description   (_("The base shape to expand or contract the selection in"))


property_int (growshrink, _("Grow to Shrink transition on selection"), 0)
  value_range   (-50, 50)
  ui_range      (-15, 15)
  ui_gamma      (1.5)
  ui_meta       ("unit", "pixel-distance")
  description (_("The distance to Grow or Shrink the selection. Left grows and right shrinks."))

property_double (opacity, _("Opacity of Mask"), 1.0)
   description (_("Decrease or increase the opacity of the mask using levels. 1 is default, 0 is completely transparent and 2 is double the default opacity."))
   value_range (0.0, 3.0)
   ui_range    (0.0, 2.0)
   ui_gamma    (3.0)

property_int (distort, _("Noise Spread to Distort selection"), 0)
   description (_("Noise Spread will distort the selection. Works best when blur is very mild or disabled."))
   value_range (0, 30)
   ui_range    (0, 30)
   ui_gamma    (3.0)

property_seed (distortseed, _("Random seed of Distort effect"), rand)


#else

#define GEGL_OP_META
#define GEGL_OP_NAME     quickmaskfilter
#define GEGL_OP_C_SOURCE quickmaskfilter.c

#include "gegl-op.h"

static void attach (GeglOperation *operation)
{
  GeglNode *gegl = operation->node;

  GeglNode *input  = gegl_node_get_input_proxy (gegl, "input");
  GeglNode *output = gegl_node_get_output_proxy (gegl, "output");


   GeglNode *spread   = gegl_node_new_child (gegl,
                                  "operation", "gegl:noise-spread",  NULL);

    GeglNode *blur      = gegl_node_new_child (gegl, "operation", "gegl:gaussian-blur", NULL);

    GeglNode *median     = gegl_node_new_child (gegl, "operation", "gegl:median-blur",
                                         "percentile",       100.0,
                                         "alpha-percentile", 50.0,
                                         NULL);

    GeglNode *increaseopacity     = gegl_node_new_child (gegl, "operation", "gegl:levels", NULL);
                             
  gegl_node_link_many (input, spread, median, blur, increaseopacity, output, NULL);

  gegl_operation_meta_redirect (operation, "opacity", increaseopacity, "out-high");
  gegl_operation_meta_redirect (operation, "distort", spread, "amount-y");
  gegl_operation_meta_redirect (operation, "distort", spread, "amount-x");
  gegl_operation_meta_redirect (operation, "distortseed", spread, "seed");
  gegl_operation_meta_redirect (operation, "feather", blur, "std-dev-x");
  gegl_operation_meta_redirect (operation, "feather", blur, "std-dev-y");
  gegl_operation_meta_redirect (operation, "growshrink", median, "radius");
  gegl_operation_meta_redirect (operation, "growshrinkshape", median, "neighborhood");

}

static void
gegl_op_class_init (GeglOpClass *klass)
{
  GeglOperationClass *operation_class;

  operation_class = GEGL_OPERATION_CLASS (klass);

  operation_class->attach = attach;


  gegl_operation_class_set_keys (operation_class,
    "name",        "lb:modifyselection",
    "title",       _("Modify Selection"),
    "reference-hash", "consciousnesscreatesreality0",
    "description", _("Apply a filter on a quick mask, layer mask, or erase blend mode to modify the selection. Fact 1: GEGL can apply filters on quick mask alone, but if you click on a Gimp layer it will then apply said effect to the layer you clicked. You can re-instruct GEGL to apply the filter on the quick mask by disabling and re-enabling the quick mask. Hint: When used unintendedly this filter can make a stained glass effect."
                     ""),
    "gimp:menu-path", "<Image>/Select/",
    "gimp:menu-label", _("Selection Grow/Shrink and Feather with GEGL (apply on quick mask, layer mask, or erase blend mode)"),
    NULL);
}

#endif


Last edited by contrast_ on Thu Feb 08, 2024 2:51 pm, edited 1 time in total.

Top
 Post subject: Re: GEGL Selection mask with live preview (coming soon)
PostPosted: Thu Feb 08, 2024 12:28 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1458
REMEMBER TO MAKE A QUICK MASK, LAYER MASK OR ERASE BLEND MODE FILL BEFORE RUNNING THIS FILTER

Download binaries here


dll is for Windows so is for Linux


LOCATION TO PUT BINARIES

**Windows**

C:\Users\(USERNAME)\AppData\Local\gegl-0.4\plug-ins

**Linux**

/home/(USERNAME)/.local/share/gegl-0.4/plug-ins

**Linux (Flatpak includes Chromebook)**

/home/(USERNAME)/.var/app/org.gimp.GIMP/data/gegl-0.4/plug-ins

THEN RESTART GIMP AND GO TO GEGL OPERATIONS and look for Modify Selection in Gimp 2.99.16+ it will be in the main menu in Selection


Last edited by contrast_ on Thu Feb 08, 2024 2:44 pm, edited 1 time in total.

Top
 Post subject: Re: GEGL selection modification filter to apply on layer mask(coming s
PostPosted: Thu Feb 08, 2024 11:40 am  (#7) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1458
This filter is on hold until I figure out how to get the feather to work more professional.

Feather only works on very specific settings, I could make a built in preset for feather or make an alt mode just for feathering.
Attachment:
feather_limited.png
feather_limited.png [ 275.3 KiB | Viewed 377 times ]



Also an update happened and the filter now has an invert checkbox to invert the layer mask.


Top
 Post subject: Re: GEGL selection modification filter to apply on layer mask(coming s
PostPosted: Thu Feb 08, 2024 2:42 pm  (#8) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1458
Update. This code and binaries provided has new features like an invert mask checkbox, and seperate opacity sliders for the mask and the content. The feather slider will work like a charm but only if high content opacity slider is at a high number. (3-5)

Attachment:
quickmask_filter.zip [361.78 KiB]
Downloaded 12 times


Top
 Post subject: Re: GEGL selection modification filter to apply on layer mask
PostPosted: Thu Feb 08, 2024 9:02 pm  (#9) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1458
https://github.com/LinuxBeaver/Gimp_Lay ... or_Plugin/

Attachment:
layer_mask_filter_preview.png
layer_mask_filter_preview.png [ 498.71 KiB | Viewed 343 times ]



This plugin is now released and as of now the official release on Github is the same as the link above.


Top
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Apply Selection to Layer with LIVE PREVIEW

6

No new posts Attachment(s) GEGL Jelly - Apply on Duplicate Layer above and use eraser

3

No new posts Attachment(s) Plugin gives non-destructive GEGL Filters in 2.99.19+ layer mask

2

No new posts Attachment(s) GEGL Layer Effects and Text Styling filter

189

No new posts Attachment(s) Custom Font Apply Selection v0.1

4



* Login  



Powered by phpBB3 © phpBB Group