It is currently Wed May 22, 2024 9:52 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 88 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Sun Dec 10, 2023 5:17 pm  (#51) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
I know but that website doesn't run through a cli via bash


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Sun Dec 10, 2023 9:20 pm  (#52) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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 39846 times ]


Attachment:
amazing_gegl_fun.png
amazing_gegl_fun.png [ 757.53 KiB | Viewed 39846 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 ]



Last edited by contrast_ on Fri Jan 05, 2024 2:42 pm, edited 2 times in total.

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Sun Dec 10, 2023 9:30 pm  (#53) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Mon Dec 11, 2023 2:08 am  (#54) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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 39738 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


Last edited by contrast_ on Fri Jan 05, 2024 2:43 pm, edited 1 time in total.

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Mon Dec 11, 2023 4:08 pm  (#55) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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 39684 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.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Mon Dec 11, 2023 5:19 pm  (#56) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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 39677 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/


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Mon Dec 11, 2023 7:58 pm  (#57) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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 39665 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]


Last edited by contrast_ on Fri Jan 05, 2024 2:45 pm, edited 2 times in total.

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Mon Dec 11, 2023 9:28 pm  (#58) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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 39662 times ]



Or saturate and color adjust the duck (more realistic)

Attachment:
duck_saturate.png
duck_saturate.png [ 929.64 KiB | Viewed 39662 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


Last edited by contrast_ on Fri Jan 05, 2024 2:45 pm, edited 1 time in total.

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Tue Dec 12, 2023 7:13 am  (#59) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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 39610 times ]
Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Tue Dec 12, 2023 7:32 am  (#60) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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 39608 times ]


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Tue Dec 12, 2023 4:56 pm  (#61) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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 41963 times ]


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


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Tue Dec 12, 2023 8:06 pm  (#62) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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 17313 times ]



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


Last edited by contrast_ on Sat Dec 30, 2023 6:19 pm, edited 1 time in total.

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Tue Dec 12, 2023 8:10 pm  (#63) 
Offline
GimpChat Member
User avatar

Joined: Jul 06, 2013
Posts: 2607
Location: California
When will a windows version be available?


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Tue Dec 12, 2023 8:30 pm  (#64) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
This only took a few seconds.

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


Attachment:
AI_power_gegl_effects.png
AI_power_gegl_effects.png [ 511.1 KiB | Viewed 17311 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 17311 times ]


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Tue Dec 12, 2023 8:31 pm  (#65) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Wed Dec 13, 2023 1:03 am  (#66) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
The plan now is to get a Windows version using Windows SubSystem for Linux instead of powershell as that can use bash.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Wed Dec 13, 2023 6:33 pm  (#67) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
This should be obvious to point out that commands that work on one image.
Attachment:
funs.png
funs.png [ 896.81 KiB | Viewed 17266 times ]


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



Do not always turn out proper on another image.
Attachment:
bash_turtle.png
bash_turtle.png [ 952.51 KiB | Viewed 17266 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.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Sat Dec 16, 2023 2:42 am  (#68) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
This is now on Github. The same download on Github is also on GimpChat


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


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Sat Dec 30, 2023 5:32 pm  (#69) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Sun Dec 31, 2023 4:34 am  (#70) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1423
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 91 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 13631 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.


Last edited by contrast_ on Sun Dec 31, 2023 4:25 pm, edited 2 times in total.

Top
Post new topic Reply to topic  [ 88 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Is it possible to make a plugin that runs bash scripts on a clipboard

1

No new posts Please make a python plugin to combine my GEGL filters with GMIC

1

No new posts Attachment(s) Baby's first GEGL plugin - a very basic GEGL plugin anyone can make.

9

No new posts Attachment(s) GEGL Background on top (first public GEGL plugin of 2024)

0

No new posts Someone other then me made a GEGL plugin using my tactics

1



* Login  



Powered by phpBB3 © phpBB Group