Switch to full style
Post all Gimp scripts and script writing questions here
Post a reply

Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl

Sun Dec 10, 2023 2:15 am

EXTREMELY EXCITING NEWS. THIS PLUGIN UPDATED AND NOW LOADS IN A FEW SECONDS OR LESS ON MOST IMAGES IF THE USER CHECKS AND UNCHECKS A CHECKBOX. IT ALSO IS WAY SIMPLER TO USE

ok its official I am now a co-developer of this bash plugin because I made these modifications to Liam's tool.

Here is it loading very quicky because I pressed the checkbox twice, and notice the two entry boxes? One of them is for bash and the other is for GEGL syntax that comes after bash, and the bash only updates if the checkbox is enabled.

funs2.png
funs2.png (539.5 KiB) Viewed 51675 times


A known inconvenience that is not a bug exist, it loads the previous image in /tmp/out.png. Once the bash string updates it will replace the picture of the young lady with the bird background removed. The previous image still loads and we can't currently solve this.
known_issues.png
known_issues.png (597.49 KiB) Viewed 51675 times


Applying the same REMBG and GEGL string command on multiple images and 100% automated in a few seconds. REMEMBER TO PRESS THE CHECKBOX TWICE

The GEGL commands load even if the bash string is not active. The bash string is the only one that is disabled until the checkbox is pressed. This will be on my Github soon

https://github.com/LinuxBeaver/

same_and_quick.png
same_and_quick.png (890.46 KiB) Viewed 51675 times

Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl

Sun Dec 10, 2023 2:17 am

Update here to the December 10th 2023 version (non flatpak Linux only) and this time it is in GEGL operation under the name Bash Plugin

download/file.php?id=70425

Location to put binaries
/home/(USERNAME)/.local/share/gegl-0.4/plug-ins

Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl

Sun Dec 10, 2023 2:43 am

Oh yeah I forgot to mention by default this loads the most likely REMBG directory for most systems. If typing in REMBG in bash works for you then this will instantly call REMBG. Perhaps I can make separate plugins. One for REMBG, one for GFPGAN and one for GMIC but that would be silly as most people here I assume know how to paste bash syntax and of course people use mini conda that is an alt directory. tee hee

Now Remember, this known problem that everyone will have to get use to

prev.png
prev.png (1.14 MiB) Viewed 51665 times


prev2.png
prev2.png (1.16 MiB) Viewed 51665 times




BTW readers, if I get professional help and attention for "big Gimp Youtube channels" I will consider porting this to Windows in Power Shell and making an even better GUI.

Make sure to check out my other work and plugins like my layer effects engine ( I am only posting this because I know this thread is getting a lot of views) and I want to point people to my other awesome work in Gimp

https://github.com/LinuxBeaver/GEGL-Eff ... using-GEGL


Image

pasted_image098.png
pasted_image098.png (815.93 KiB) Viewed 51665 times



Have an awesome day everyone. I care about Gimp so much. :gimp

Re: GEGL calls GMIC, REMBG, AIs or any bash string our bash plugin

Sun Dec 10, 2023 3:06 am

Here's System GMIC being called with the update. It is so much easier.


So If you uncheck it to early the filter may glitch, that is an indication you need to wait longer before unchecking. I made that mistake on this early. Smoothing is slow.

so_fun_gegl.png
so_fun_gegl.png (724.23 KiB) Viewed 51656 times



Here try this command yourself

Box 1 for bash
Code:
gmic /tmp/in.png output /tmp/out3.jpg   && gmic -i /tmp/out3.jpg  fx_smooth_anisotropic 10,0.512,1,2.15,8.61,1.6504,80.48,5,0,1,10,0,0,50,50  -o /tmp/out.png


Box 2 for GEGL
Code:
bloom strength=9
saturation scale=1.3

Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl

Sun Dec 10, 2023 3:51 am

GMIC Anistropic smoothing followed by GEGL saturation, cartoon, emboss by overlay and bloom.

1 GMIC filter and 4 GEGL filters chained together.

gmic_and_bash.png
gmic_and_bash.png (1.45 MiB) Viewed 51633 times


COMMAND FOR BASH BOX
Code:
gmic /tmp/in.png output /tmp/out3.jpg   && gmic -i /tmp/out3.jpg  fx_smooth_anisotropic 10,0.512,1,2.15,8.61,1.6504,80.48,5,0,1,10,0,0,50,50  -o /tmp/out.png



COMMAND FOR GEGL BOX
Code:
saturation scale=1.6

id=1 gimp:layer-mode layer-mode=normal opacity=0.15 aux=[ ref=1 cartoon ]

id=2 gimp:layer-mode layer-mode=overlay opacity=0.25 aux=[ ref=1 emboss ]

bloom  strength=25

Re: GEGL calls GMIC, REMBG, AIs or any bash string our bash plugin

Sun Dec 10, 2023 4:25 am

ok, I just did another mini update bug fix. All downloads are up to date. There is still a unique bug that sometimes occurs and can only be solved by typing

nop (the do nothing command) or any valid gegl syntax in the GEGL box.

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Sun Dec 10, 2023 2:45 pm

I'm calling the system's GEGL in Gimp so I can run GEGL commands before bash. However due to running system GEGL means I have to have the non Gimp GEGL package installed (sudo apt install gegl)


theory_of_smooth_paint.png
theory_of_smooth_paint.png (1.27 MiB) Viewed 51324 times


Information to give Bash Box

Code:
gegl -i /tmp/in.png -o /tmp/outgegl.png -- gegl:gegl string=' gaussian-blur std-dev-x=0.5 std-dev-y=0.5  id=containall src aux=[ ref=containall id=1 posterize levels=10 cubism tile-size=10 id=0 dst-out aux=[ ref=0  component-extract component=alpha levels in-low=0.15  color-to-alpha opacity-threshold=0.4 ] over aux=[ ref=1 opacity value=0.3 ] id=3 overlay srgb=true aux=[ ref=3 emboss opacity value=0.3 ] ] crop ' && gmic /tmp/outgegl.png output /tmp/out3.webp   && gmic -i /tmp/out3.webp fx_smooth_anisotropic 10,0.512,1,2.15,8.61,1.6504,80.48,5,0,1,10,0,0,50,50  -o /tmp/out.png


Information to give GEGL box
Code:
unsharp-mask scale=1.1

not much lol. In fact we could have done the entire thing in the bash box.

Also here is another command with bash syntax unique to my system's custom GFPGAN directory so I cannot post a code box of it. GMIC's jpeg smooth GFPGAN, REMBG and GEGL commands to outline and add a background were added.
This only took 7 seconds where as a few days ago it may have took over 5 minutes
amazing_progress_gegl_bash.png
amazing_progress_gegl_bash.png (821.85 KiB) Viewed 51324 times



So readers just know that it is possible that a Windows version may come soon as we are figuring out how to call PowerShell in this.

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Sun Dec 10, 2023 2:49 pm

If I get someone professional to help me and host a website with REMBG with special exceptions I will attempt to run REMBG in the cloud from GEGL to show that it is possible to do without installing REMBG.

I can't do it myself so I hope a knowledgable participant chimes in.

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Sun Dec 10, 2023 3:56 pm

There is already this site.... https://www.remove.bg/

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Sun Dec 10, 2023 5:17 pm

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

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Sun Dec 10, 2023 9:20 pm

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)

rembg_and_bg_blur.png
rembg_and_bg_blur.png (910.26 KiB) Viewed 41942 times


amazing_gegl_fun.png
amazing_gegl_fun.png (757.53 KiB) Viewed 41942 times



Bash Code

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



GEGL Code
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 ]

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Sun Dec 10, 2023 9:30 pm

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.

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Mon Dec 11, 2023 2:08 am

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


fish_select.png
fish_select.png (483.92 KiB) Viewed 41834 times


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


GEGL Syntax (requires two of my plugins)

Code:
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

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Mon Dec 11, 2023 4:08 pm

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.


real_esrgan.png
real_esrgan.png (351.41 KiB) Viewed 41780 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

Code:
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.

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Mon Dec 11, 2023 5:19 pm

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


image_magick_instant.png
image_magick_instant.png (580.73 KiB) Viewed 41773 times


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


GEGL Command
Code:
  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/

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Mon Dec 11, 2023 7:58 pm

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.

recolor_car_aqua_blue.png
recolor_car_aqua_blue.png (898.69 KiB) Viewed 41761 times


Command for Bash box
Code:
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
Code:

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

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Mon Dec 11, 2023 9:28 pm

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.

blue_duck.png
blue_duck.png (1 MiB) Viewed 41758 times



Or saturate and color adjust the duck (more realistic)

duck_saturate.png
duck_saturate.png (929.64 KiB) Viewed 41758 times



COMMAND FOR BASH BOX


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


COMMAND FOR GEGL BOX (Requires my plugins chrome and Threshold alpha 2)
Code:
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

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Tue Dec 12, 2023 7:13 am

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.

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Tue Dec 12, 2023 7:32 am

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

rembg_in_gegl_effects.png
rembg_in_gegl_effects.png (611.98 KiB) Viewed 41704 times

Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi

Tue Dec 12, 2023 4:56 pm

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.

AI_in_gegl_effects.png
AI_in_gegl_effects.png (1.09 MiB) Viewed 44906 times


AI_effects_2.png
AI_effects_2.png (1.04 MiB) Viewed 44906 times
Post a reply