It is currently Sat Jun 15, 2024 6:39 pm


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: Tue Dec 12, 2023 4:56 pm  (#61) 
Offline
GimpChat Member
User avatar

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


Attachment:
AI_effects_2.png
AI_effects_2.png [ 1.04 MiB | Viewed 44853 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: 1437
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 18245 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: 1437
This only took a few seconds.

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


Attachment:
AI_power_gegl_effects.png
AI_power_gegl_effects.png [ 511.1 KiB | Viewed 18243 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 18243 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: 1437
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: 1437
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: 1437
This should be obvious to point out that commands that work on one image.
Attachment:
funs.png
funs.png [ 896.81 KiB | Viewed 18198 times ]


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



Do not always turn out proper on another image.
Attachment:
bash_turtle.png
bash_turtle.png [ 952.51 KiB | Viewed 18198 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: 1437
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: 1437
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: 1437
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 14563 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 subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Sun Dec 31, 2023 6:11 am  (#71) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
contrast_ wrote:
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.


It works here with:
rembg i /tmp/in.png /tmp/out.png


It is extremely slow and had to wait a long time to notice it was working. At least this is a third option. Using command line or JamesH plugin is at least 50 times faster. JamesH also includes Layer Mask to help fine tune.

Thanks for this tool contrast.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Sun Dec 31, 2023 2:41 pm  (#72) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1437
racer-x wrote:
contrast_ wrote:
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.


It works here with:
rembg i /tmp/in.png /tmp/out.png


It is extremely slow and had to wait a long time to notice it was working. At least this is a third option. Using command line or JamesH plugin is at least 50 times faster. JamesH also includes Layer Mask to help fine tune.

Thanks for this tool contrast.



I put this here earlier this month.

Attachment:
checkbox_disclaimer.png
checkbox_disclaimer.png [ 19.16 KiB | Viewed 12278 times ]


I made it clear how to solve this problem earlier in this thread. The slow wait is mandatory in Liam's boy:spawn but my additional plugin lb:bash solves that problem with a checkbox.

The checkbox is meant to be pressed on and off after typing a bash command. This is so it would not be extremely slow. Enabling the checkbox runs the bash command and disabling it cancels it. The reason things are so slow is because GEGL is literally rerunning REMBG dozens of times. We don't know how to stop this outside of the checkbox.

I tested on multiple machines in Gimp, and they all have the same problem with going extremely slow without the checkbox, but the checkbox flicking on and off it only takes a few seconds to run REMBG. On my machine if I check and uncheck the box it will take a few seconds. If I don't it will take a few minutes.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Thu Jan 04, 2024 7:27 pm  (#73) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1437
This code is partially unique to my system but it uses generic bash commands to call GMIC and the systems GEGL. So what I will do is remove all commands unique to my system and list universal commands.

Requires packages gegl and gmic (sudo apt install gegl gmic)

Attachment:
flatpak_bash_block_text.png
flatpak_bash_block_text.png [ 403.22 KiB | Viewed 11261 times ]


Command for Bash Box
gegl -i /tmp/in.png -o /tmp/outgegl.png -- gegl:gegl string=" color-overlay value=#ff0000 crop "  && sleep 0.5 && gmic /tmp/outgegl.png output /tmp/outgegl.webp && gmic /tmp/outgegl.webp  fx_blocks3d 128,0,6.86,1.5,0,10.08,45,50.1818,54.9091,0,-50,-100,0.5,0.7,1,1,0,0,0,128 -o /tmp/out.png   


Command for GEGL Box

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

saturation scale=2.0
translate y=-166.5

median-blur radius=0
id=1 gimp:layer-mode layer-mode=overlay opacity=0.73 aux=[ ref=1 emboss elevation=0 ]
median-blur radius=0
id=2 gimp:layer-mode layer-mode=hardlight opacity=1 composite-mode=auto aux=[ ref=2 noise-solid x-size=2 y-size=8  seed=344 color-to-alpha color=white opacity value=1.06 ]
levels in-high=0.8

bloom strength=220
id=3 gimp:layer-mode layer-mode=addition opacity=0.24 aux=[ ref=3 edge amount=4 ]

id=4 dst-over aux=[ ref=4 color-overlay value=black cubism tile-size=14

gaussian-blur std-dev-x=17 std-dev-y=17  opacity value=0.4 ]

dst-over aux=[ ref=4 color-overlay value=black

translate y=08 gaussian-blur std-dev-x=17 std-dev-y=17  opacity value=0.61 ]
median-blur radius=0
levels in-low=0.02

hue-chroma hue=-93 lightness=3
median-blur radius=0
unsharp-mask scale=1.1


Attachment:
green_ver_of_3d_blocks.png
green_ver_of_3d_blocks.png [ 335.03 KiB | Viewed 11261 times ]


Attachment:
pasted_image100.png
pasted_image100.png [ 1012.87 KiB | Viewed 11261 times ]


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Fri Jan 05, 2024 2:46 pm  (#74) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1437
I just edited every posted messages bash code to list the modern REMBG and not the early 2022 version. It was my fault for using an outdated version of REMBG.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Mon Jan 08, 2024 4:17 am  (#75) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1437
Here is the bash plugin calling GMIC's voronoi filter, then I run a chain of GEGL filters using GEGL syntax.

The GEGL filters are color to alpha running twice to remove white then black, emboss by overlay, levels for lighting, sharpen and two drop shadows. Many GEGL filters were used. This effect shows GMIC and GEGL working together.

Attachment:
voronoi_gmic.png
voronoi_gmic.png [ 796.9 KiB | Viewed 10588 times ]


Attachment:
pasted_image120.png
pasted_image120.png [ 823.13 KiB | Viewed 10588 times ]


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Mon Jan 08, 2024 12:40 pm  (#76) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1437
Attachment:
pasted_image122.png
pasted_image122.png [ 746.17 KiB | Viewed 10492 times ]


For some reason the text is always red in default even if the original color is something else. So I used GEGL Hue Chroma in the graph to rotate colors and make it green. I also added a third drop shadow.


This was all automated


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Tue Jan 16, 2024 4:17 pm  (#77) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1437
Here is an example of practical use of my bash plugin calling GMIC's JPEG SMOOTH then GFPGAN to restore someone's old photo.
Attachment:
AI_FACE_FUN.png
AI_FACE_FUN.png [ 264.8 KiB | Viewed 10169 times ]


I also used sharpening and eye lighting manually in Gimp.

Original

Attachment:
original.png
original.png [ 159.54 KiB | Viewed 10169 times ]


Final
Attachment:
final.png
final.png [ 190.32 KiB | Viewed 10169 times ]


Bash Box command (unique to my system)
flatpak-spawn --host bash -c '

gmic /home/contrast/tmp/in.png output /home/contrast/tmp/out3.webp   && gmic -i /home/contrast/tmp/out3.webp  gcd_jpeg_smooth 1,1,0,0  -o /home/contrast/tmp/out2.png && source /home/contrast/Applications/mc/etc/profile.d/conda.sh && conda activate base && cd /home/contrast/Applications/GFPGAN/ && python inference_gfpgan.py -i /home/contrast/tmp/out2.png -o /home/contrast/tmp/face -v 1.3 -s 1 && mv /home/contrast/tmp/face/restored_imgs/out2.png  /home/contrast/tmp/out.png
   '


GEGL Box command
NA



This took a few seconds and I saved the preset so I can rerun this face restoration command on any image that has faces. The Gimp community needs to study GEGL, I shouldn't be the only one doing this.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Tue Jan 16, 2024 7:08 pm  (#78) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1437
These commands are unique to my system meaning you have to replace all my local directories with your own directory for this to work. But I'll post them anyway just so people can study it. (if they care about GEGL) Its literally just bash on my machine calling AI and GMIC.

I am doing the same thing as the post above calling GMIC's JPEG Smooth and GFPGAN in GEGL bash, but this time the difference is that I will be using the GEGL Box below to call the image file with JPEG Smooth (Without Face restoration) to be on 35% opacity to make GFPGAN look less "hyper real". "Hyper Real" is a term where GFPGAN restores a face's quality so good that it looks out of place. The 35% normal layer mode blend with the "GMIC Jpeg Smooth layer" is to reduce the quality of GFPGAN. This is like stacking two normal layers on top of each other with one layer at 35% opacity.

Command for Bash Box (highly unique to my system)
flatpak-spawn --host bash -c '

gmic /home/contrast/tmp/in.png output /home/contrast/tmp/out3.webp   && gmic -i /home/contrast/tmp/out3.webp  gcd_jpeg_smooth 1,1,0,0  -o /home/contrast/tmp/out2.png && source /home/contrast/Applications/mc/etc/profile.d/conda.sh && conda activate base && cd /home/contrast/Applications/GFPGAN/ && python inference_gfpgan.py -i /home/contrast/tmp/out2.png -o /home/contrast/tmp/face -v 1.3 -s 1 && mv /home/contrast/tmp/face/restored_imgs/out2.png  /home/contrast/tmp/out.png
   '


Command for GEGL Box (requires swapping DIRNAMES)
id=1 gimp:layer-mode layer-mode=normal opacity=0.35 aux=[ ref=1 layer src=/home/contrast/tmp/out2.png   ]
saturation scale=1.13

The saturation at the end is not needed. I just put it there because I wanted a mild saturation boost.

If you make the opacity 0.50, the GFPGAN layer will be half transparent. If it is at 1, it will be entirely replaced by the JPEG Smooth layer.

This is the final output when GFPGAN's effect is 35% reduced
Attachment:
new_discovery_GFPGAN.png
new_discovery_GFPGAN.png [ 287.02 KiB | Viewed 10164 times ]


This is the final output when GFPGAN's effect is 100% reduced (hidden by the JPEG smooth image)
Attachment:
hidden_opacity_100.png
hidden_opacity_100.png [ 253.9 KiB | Viewed 10164 times ]


These are the files GEGL created while running the bash command.
Attachment:
files_gegl_is_interacting_with.png
files_gegl_is_interacting_with.png [ 271.24 KiB | Viewed 10164 times ]


Info about the folder and files:

Flatpak Gimp cannot use /tmp/ or /var/tmp/ so I made a bogus /home/username/tmp/

Many GMIC filters "glitch out" on png so I use GMIC to convert the file to webp before I run a GMIC filter then, while running the GMIC filter it is instructed to covert the output of the filter back to .png. As seen here.

gmic /home/contrast/tmp/in.png output /home/contrast/tmp/out3.webp   && gmic -i /home/contrast/tmp/out3.webp  gcd_jpeg_smooth 1,1,0,0  -o /home/contrast/tmp/out2.png



I am fully aware that it is sloppy how I am naming files out2, out3. I just put a number in front of it for convenience. This stuff I am doing with GEGL is very advance and I hope others reach this point one day.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Sun Feb 18, 2024 10:00 am  (#79) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1437
*POST EDITED TO CORRESPOND TO CMYK STUDENT'S CORRECTION

GEGL converts RGBA to CMYK by calling Image Magick (Linux only)
This is a short guide on RGB to CMYK conversions in my GEGL bash plugin. Image Magick does all the work but GEGL exports the png on canvas. This assumes you have Image Magick and my plugin GEGL bash installed. If not install them below.

https://imagemagick.org/script/command-line-options.php
https://github.com/LinuxBeaver/AI_in_Gi ... h/releases


1.

Download this and save it somewhere you'll rememeber
https://github.com/ImageMagick/ImageMag ... g/cmyk.icm

2.

Find the image you want to convert to CMYK preview and save it as an .icc file in Gimp using "save color profile to file"
Image

Image

after doing it once you have the option to never do it again, but it may slighly impact the quaility of the CMYK convert. Doing it each time guarantees maximum image quality from what I understand.


3.



Code to convert exported layer png in Gimp to CMYK requires changing dirname to wherever you saved the .icm files.

Bash Box
    convert /tmp/in.png +profile icm \
            -profile /home/USERNAME/.local/share/icc/rgb_profile.icc  -profile /home/username/dir/cmyk.icm /tmp/out.tiff


GEGL Box
To Import the tiff file
src aux=[ layer src=/tmp/out.tiff ]


Attachment:
cmyk_rgb_convert_for_real.png
cmyk_rgb_convert_for_real.png [ 804.87 KiB | Viewed 9359 times ]



If this could be ran like an adjustment layer in "Display Filters" everywhere on canvas we could get a cheap CMYK conversion. Hopefully I or someone else figures out a way to auto grab the icc information from an RGB file. So it doesn't have to be done manually each time for max quality. I hope this RGB to CMYK conversion in GEGL bash is useful to someone's workflow. Remember the second step might only have to be done once.


Last edited by contrast_ on Sun Feb 18, 2024 10:50 am, edited 4 times in total.

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with our bash plugi
PostPosted: Sun Feb 18, 2024 10:04 am  (#80) 
Offline
GimpChat Member

Joined: Dec 28, 2023
Posts: 33
contrast_: Cool! As a heads-up, PNG doesn't support CMYK (the CMYK colors would be treated as RGB on export). You would need to export as a TIFF or JPEG if you want the exported file to be treated as CMYK by other programs.


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 GEGL plugin that outlines with a bevel and more

0



* Login  



Powered by phpBB3 © phpBB Group