GIMP Chat
http://gimpchat.com/

GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugin
http://gimpchat.com/viewtopic.php?f=9&t=20652
Page 3 of 5

Author:  contrast_ [ Sun Dec 10, 2023 5:17 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

I know but that website doesn't run through a cli via bash

Author:  contrast_ [ Sun Dec 10, 2023 9:20 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

I wrote new syntax that blurs the background after running REMBG.

It requires these two plugins of mine to work ideally. This only takes a few seconds on my machine.

https://github.com/LinuxBeaver/Threshol ... /releases/
https://github.com/LinuxBeaver/Gimp-Plu ... -/releases
(chrome text ships with edge smooth that it requires)

Attachment:
rembg_and_bg_blur.png
rembg_and_bg_blur.png [ 910.26 KiB | Viewed 41909 times ]


Attachment:
amazing_gegl_fun.png
amazing_gegl_fun.png [ 757.53 KiB | Viewed 41909 times ]



Bash Code

rembg i /tmp/in.png /tmp/out.png



GEGL Code

      id=all
src aux=[ ref=all

lb:threshold-alpha alphadegree=1
id=1 gimp:layer-mode layer-mode=normal opacity=0.7 aux=[ ref=1]

lb:edgesmooth alpha-percentile2=80

id=2 dst aux=[ ref=2 id=erase ]

id=3 dst-over aux=[ layer src=/tmp/in.png xor aux=[ ref=erase ] id=background_gap ]

xor aux=[ layer src=/tmp/out.png ]



gaussian-blur std-dev-x=30 std-dev-y=30

crop
median-blur radius=10 alpha-percentile=100
gimp:threshold-alpha value=0.4 lb:edgesmooth

bloom strength=9
]


over aux=[ layer src=/tmp/out.png
lb:threshold-alpha alphadegree=1 id=rembgremove gimp:layer-mode layer-mode=normal opacity=0.5 aux=[ ref=rembgremove] lb:edgesmooth alpha-percentile2=80
dropshadow grow-radius=10 radius=14 x=33 opacity value=1 ]


Author:  contrast_ [ Sun Dec 10, 2023 9:30 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Stat regarding a hopeful Windows version


I tested this plugin on Windows and it appears to by default trying to communicate with cmd.exe and not powershell. cmd.exe was rapidly opening and closing. When I typed in powershell --command it froze Gimp indefinitely and an error window popped up about reporting it. We are going to see if we can get a separate Windows version of this plug-in now that we know it at least tries to talk to Windows.

This will be the first GEGL plugin of mine that has two special versions for both Windows and Linux. In every other case what works on Windows works on Linux.

Author:  contrast_ [ Mon Dec 11, 2023 2:08 am ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

This instructs GEGL to remove a background with REMBG and fix rembg erosion, then blend the fish with the hard light blend mode on saturation followed up by a blue outline.

This requires these two plugins to work

https://github.com/LinuxBeaver/Threshol ... n/releases
https://github.com/LinuxBeaver/GEGL---C ... r/releases


Attachment:
fish_select.png
fish_select.png [ 483.92 KiB | Viewed 41801 times ]


Bash Command
rembg i /tmp/in.png /tmp/out.png


GEGL Syntax (requires two of my plugins)

lb:threshold-alpha alphadegree=1 id=rembgremove gimp:layer-mode layer-mode=normal opacity=0.5 aux=[ ref=rembgremove] lb:edgesmooth alpha-percentile2=80 ]
saturation scale=1.4
id=2 hard-light aux=[  ref=2 opacity value=0.4 saturation scale=1.6 ]
hue-chroma lightness=1
dropshadow x=0 y=0 radius=0 opacity=2 grow-radius=4  color=#00f4ff
median-blur radius=0
dropshadow x=9 y=0 opacity=0.9

Author:  contrast_ [ Mon Dec 11, 2023 4:08 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

REAL ESRGAN AND IMAGE MAGICK CALLED FROM BASH IN GEGL
Image Magick was called to scale down RealESRGAN 4x to 25% of its original size
so it would fit the original image in Gimp's canvas. I used Lancoz interpolation which is the best Image Magick has.


Attachment:
real_esrgan.png
real_esrgan.png [ 351.41 KiB | Viewed 41747 times ]



The original string only works on my computer but I made a modified version that may work on other machines that have REALESRGAN and ImageMagick installed in generic directories.

Bash Command

realesrgan-ncnn-vulkan -i /tmp/in.png -o /tmp/out3.webp -n realesrgan-x4plus s= 2 && magick /tmp/out3.webp  -filter Lanczos -resize 25% /tmp/out4.webp && gmic /tmp/out4.webp output /tmp/out.png


GEGL Syntax
NA - this stays empty unless you want to put something

I also tested running REALESRGAN, GFPGAN and REMBG at at once and it worked but took over 25 seconds. It probably would have took 30 minutes a few days ago before the update.

Author:  contrast_ [ Mon Dec 11, 2023 5:19 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Here's GEGL calling an image magick filter followed by GEGL's Sharpen. This loads instantly because it is just a simple lighting filter


Attachment:
image_magick_instant.png
image_magick_instant.png [ 580.73 KiB | Viewed 41740 times ]


Bash Command
magick /tmp/in.png +level-colors red, /tmp/out.png


GEGL Command
  unsharp-mask scale=2



Learn how to write image magick syntax here
https://imagemagick.org/script/command-line-options.php

Learn how to write GEGL syntax here
gegl.org/

Author:  contrast_ [ Mon Dec 11, 2023 7:58 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

UPDATE, THIS CODE REQUIRES GEGL'S BLENDING OPTION TO BE SET TO NORMAL, as opposed to the default replace.


Here is an example of me using the system's GEGL + REMBG then Gimp's GEGL to recolor an object inside the image.

The car goes from Yellow to Aqua Blue.

Attachment:
recolor_car_aqua_blue.png
recolor_car_aqua_blue.png [ 898.69 KiB | Viewed 41728 times ]


Command for Bash box
gegl i /tmp/in.png /tmp/outgegl.png -- gegl:gegl string=' hue-chroma hue=134 saturation scale=0.8 levels out-high=0.9 unsharp-mask scale=0.8  ' && rembg /tmp/outgegl.png -o /tmp/out.png



Command for GEGL box

lb:threshold-alpha alphadegree=1
id=1 gimp:layer-mode layer-mode=normal opacity=0.2 aux=[ ref=1]

Author:  contrast_ [ Mon Dec 11, 2023 9:28 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

UPDATE, THIS CODE REQUIRES GEGL'S BLENDING OPTION TO BE SET TO NORMAL, as opposed to the default replace.

Recolor an
object study 2. Make the duck blue.

Attachment:
blue_duck.png
blue_duck.png [ 1 MiB | Viewed 41725 times ]



Or saturate and color adjust the duck (more realistic)

Attachment:
duck_saturate.png
duck_saturate.png [ 929.64 KiB | Viewed 41725 times ]



COMMAND FOR BASH BOX


rembg i /tmp/in.png /tmp/out.png


COMMAND FOR GEGL BOX (Requires my plugins chrome and Threshold alpha 2)
lb:threshold-alpha alphadegree=1
id=1 gimp:layer-mode layer-mode=normal opacity=0.2 aux=[ ref=1]
unsharp-mask scale=0.3
saturation scale=1.6
levels out-low=0.004
hue-chroma lightness=1
bloom strength=4

Author:  contrast_ [ Tue Dec 12, 2023 7:13 am ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

REMBG AND BASH BOX IN MY GEGL EFFECTS PLUGIN

I got bash box working in an unreleased version of my layer effects engine. GEGL Effects is applying effects after REMBG, but it can also do any other bash string.


Here is the download to my GEGL Effects layer effects engine that does NOT include this update. But soon it will!
https://github.com/LinuxBeaver/GEGL-Eff ... L/releases



Now that we know GEGL is capable of doing all this, its safe to say Gimp's future is secured.

Attachments:
rembg_gegl_effects.png
rembg_gegl_effects.png [ 561.31 KiB | Viewed 41673 times ]

Author:  contrast_ [ Tue Dec 12, 2023 7:32 am ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

It is so exciting to see REMBG inside an unreleased version of GEGL Effects! Its amazing how these workflows are being automated.

Attachment:
rembg_in_gegl_effects.png
rembg_in_gegl_effects.png [ 611.98 KiB | Viewed 41671 times ]

Author:  contrast_ [ Tue Dec 12, 2023 4:56 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

AI IN GEGL EFFECTS

It is working consistent and stable in GEGL Effects. I will push the GEGL Effects December 12 update soon and now everyone gets to see my special Linux Desktop that looks like Windows XP, lol.

Attachment:
AI_in_gegl_effects.png
AI_in_gegl_effects.png [ 1.09 MiB | Viewed 44845 times ]


Attachment:
AI_effects_2.png
AI_effects_2.png [ 1.04 MiB | Viewed 44845 times ]

Author:  contrast_ [ Tue Dec 12, 2023 8:06 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Download for the GEGL Effects update with Bash to call AI is here. But it is Linux only and doesn't work on Flatpak


Attachment:



Location to put binaries (there's a lot of them)
/home/(USERNAME)/.local/share/gegl-0.4/plug-ins


Then Restart Gimp go to GEGL Operations and look for GEGL Effects Continual Edition. Remember, GEGL Effects is both an image outline tool and a text styling engine but in the case of this I am using it for image outlining. If you already have these binaries overwrite all of them with the latest version.

Remember you need to have the AI installed and remember to check and uncheck the bash checkbox to run the bash command.




Attachment:
GEGL_Effects_AI_ready.png
GEGL_Effects_AI_ready.png [ 1.06 MiB | Viewed 18242 times ]



Don't bother compiling on windows it won't work there. we tried.

Author:  mackenzieh [ Tue Dec 12, 2023 8:10 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

When will a windows version be available?

Author:  contrast_ [ Tue Dec 12, 2023 8:30 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

This only took a few seconds.

Attachment:
split_view_effects.png
split_view_effects.png [ 636.26 KiB | Viewed 18240 times ]


Attachment:
AI_power_gegl_effects.png
AI_power_gegl_effects.png [ 511.1 KiB | Viewed 18240 times ]


and it can save and apply the same setting on anything else.

But it looks like in this case the inner glow is to expansive on the turtle, so users will have to change the original setting.

Attachment:
preset_gegl.png
preset_gegl.png [ 686.5 KiB | Viewed 18240 times ]

Author:  contrast_ [ Tue Dec 12, 2023 8:31 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

mackenzieh wrote:
When will a windows version be available?


If I get a professional to help me call Windows PowerShell. I don't know how to do this, but I guess Liam could try. I am sorry and understand that you want this on Windows.

Author:  contrast_ [ Wed Dec 13, 2023 1:03 am ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

The plan now is to get a Windows version using Windows SubSystem for Linux instead of powershell as that can use bash.

Author:  contrast_ [ Wed Dec 13, 2023 6:33 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

This should be obvious to point out that commands that work on one image.
Attachment:
funs.png
funs.png [ 896.81 KiB | Viewed 18195 times ]


Attachment:
final_love.png
final_love.png [ 405.08 KiB | Viewed 18195 times ]



Do not always turn out proper on another image.
Attachment:
bash_turtle.png
bash_turtle.png [ 952.51 KiB | Viewed 18195 times ]


Lastly, every time a GEGL preset is made the user still has to manually check and uncheck the bash checkbox in tab 9 and we already discussed way earlier in this thread how it loads the previous image file.

Author:  contrast_ [ Sat Dec 16, 2023 2:42 am ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

This is now on Github. The same download on Github is also on GimpChat


https://github.com/LinuxBeaver/AI_in_Gi ... /tree/main

Author:  contrast_ [ Sat Dec 30, 2023 5:32 pm ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

This bash plugin was not working for a lot of people because the REMBG command changed recently or at least in the past year. months. Here is a list of both rembg commands.

Latest REMBG is
rembg i /tmp/in.png /tmp/out.png


2022 REMBG is
rembg /tmp/in.png -o /tmp/out.png



The bash plugin both stand alone and GEGL Effects version updated today. To contain the newest line of code for REMBG in default. This does not count as a new version release.

Author:  contrast_ [ Sun Dec 31, 2023 4:34 am ]
Post subject:  Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

We got the plugin working on Flatpak Linux
Image

It requires a special build of the source code linked here that you must manually edit and compile, as well as a package called flatpak-spawn (that you don't need to compile). This code now also contains the GEGL Effects bash build added mid day (dec 31st 2023)
Attachment:
bash_flatpak_requires_code_editing.zip [316.34 KiB]
Downloaded 117 times


If you want Flatpak bash to work for you have to compile and replace "/home/contrast/tmp/" with your username and directory of choice. This is only for flatpak. Non flatpak users don't have to do this. The reason why is because flatpak can't use the /tmp/ directory.

First install flatpak-spawn
sudo dnf install flatpak-spawn


sudo apt install flatpak-spawn


Then download this code and open bash-buddy.c and gegleffectspending.c


then replace /home/contrast/tmp/in.png and /home/contrast/tmp/out.png with whatever directory in your own home you like such as this example. /home/john/eggs/in.png /home/john/eggs/out.png

Image shows this "search and replace" process.
Attachment:
this_is_the_way_to_do_it.png
this_is_the_way_to_do_it.png [ 4.94 KiB | Viewed 14560 times ]


then compile by running build_linux.sh and put the file in /home/(USERNAME)/.var/app/org.gimp.GIMP/data/gegl-0.4/plug-ins
and restart Gimp and go to GEGL operations.

then if that is the case a command like
flatpak-spawn --host rembg i /home/john/eggs/in.png /home/john/eggs/out.png
will work. Consider making the directory short as possible. It CANNOT use /tmp/

Lastly if you only want the bash AI plugin without GEGL Effects. Ignore all binaries but bash-buddy and spawn if you want GEGL Effects make use of all the binaries.

Page 3 of 5 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/