It is currently Fri Jun 21, 2024 12:55 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 Liam's bash pl
PostPosted: Wed Dec 06, 2023 1:37 pm  (#21) 
Offline
GimpChat Member
User avatar

Joined: Sep 27, 2016
Posts: 345
Location: Germany, BW
Quote:
Then if you haven't already install this GEGL plugin on non flatpak Linux in

https://cdn.discordapp.com/attachments/ ... 09e80be86&


Downloaded, zip unpacked, contains a "RCS" folder ( and other files) in there is a "spawn.c,v" file ?
Never seen such a file-ending before. I doubt that it's ready to use.

_________________
Regards
nelo

(Gimp 2.10 on Linux Mint MATE 20.1)


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Wed Dec 06, 2023 1:40 pm  (#22) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
A new discovery has been made with GEGL Bash Spawn that leads to it running orders of magnitude faster, as it prevents GEGL from reloading the same operation 9 times in a row. That's what is slowing it down.

Before I show case the discovery remember that /tmp/final.png is unique to the users given path.

The GEGL syntax
gegl-buffer-load

layer src=/tmp/final.png


gegl-buffer-load When ran after boy:spawn or anything in GEGL (like a blur or emboss) causes it to cancel everything and have nothing in the graph. GEGL Layer loads an image file; such as a final output in /tmp/. The plan to make GEGL Bash Spawn faster is to run the syntax I listed above after a few seconds of the user pressing a checkbox. The checkbox will activate the nodes at a several second delay.

This means GMIC filters in GEGL will load in 1 or 2 seconds instead of 10-20 seconds. Once again this is happening because gegl:buffer-load cancels everything and layer src= calls the image file that GEGL dumped in /tmp/

Example of me running GMIC's Bokeh in GEGL fast
This only took one second to load because I pasted commands strategicly.

first I pasted the command to call GMIC

id=callgmic
over aux=[ ref=callgmic

boy:spawn path-in="/tmp/first.png"  "path-out"="/tmp/final.png"   pipeline="  gmic  /tmp/first.png  output /tmp/in3.webp && gmic /tmp/in3.webp fx_bokeh 3,8,0,1,33.5,4,0.07,0.2,255,176,252,160,0.302,27,4.3,20,0.19,2,255,170,255,110,0.15,0,50,50 -o /tmp/final.png   "  ]

]


Then a second later I pasted this while Gimp was Frozen

gegl-buffer-load

layer src=/tmp/final.png


Attachment:
gmic_GEGL.png
gmic_GEGL.png [ 1.4 MiB | Viewed 69647 times ]


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Wed Dec 06, 2023 1:54 pm  (#23) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
nelo wrote:
Quote:
Then if you haven't already install this GEGL plugin on non flatpak Linux in

https://cdn.discordapp.com/attachments/ ... 09e80be86&


Downloaded, zip unpacked, contains a "RCS" folder ( and other files) in there is a "spawn.c,v" file ?
Never seen such a file-ending before. I doubt that it's ready to use.


Sorry it was source code only. I provided a download with a binary on the first page post.
download/file.php?id=70342


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Wed Dec 06, 2023 2:06 pm  (#24) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
Soon this plugin will update with a delay property. When activated the nodes gegl-buffer-load and gegl:layer will kick in and unfreeze the graph and load the file in /tmp/

This is a hypothetical example where the unfreeze and call layer nodes are delayed by 4 seconds
Attachment:
delay_nodes.png
delay_nodes.png [ 17.39 KiB | Viewed 69642 times ]


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Wed Dec 06, 2023 3:51 pm  (#25) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
Here is the same thing I did with GMIC now with REMBG. It now loads very fast with a delayed buffer.

Attachment:
pasted_image023.png
pasted_image023.png [ 372.57 KiB | Viewed 69641 times ]


Last edited by contrast_ on Mon Jan 08, 2024 4:29 am, edited 2 times in total.

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Thu Dec 07, 2023 3:46 am  (#26) 
Offline
GimpChat Member
User avatar

Joined: Sep 27, 2016
Posts: 345
Location: Germany, BW
very difficult to follow you for non-programmers :-(

What do I really have to write into the GEGL command?

in my normal working(!) bash script I activate the environment like so:
source ~/anaconda3/etc/profile.d/conda.sh
conda activate base


And if I put this in the GEGL command
boy:bash input="GEGL_IN" output="GEGL_OUT" pipeline="source ~/anaconda3/etc/profile.d/conda.sh && conda activate base && rembg -p GEGL_IN -o GEGL_OUT


nothing happens really, nothing in /tmp either

It would be really nice to have a working step by step example.
Only to get rembg to work ... nothing else. No fancy you can do this and that and so.
That only confuses me ( perhaps others, too)

_________________
Regards
nelo

(Gimp 2.10 on Linux Mint MATE 20.1)


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Thu Dec 07, 2023 4:29 am  (#27) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
nelo wrote:
very difficult to follow you for non-programmers :-(

What do I really have to write into the GEGL command?

in my normal working(!) bash script I activate the environment like so:
source ~/anaconda3/etc/profile.d/conda.sh
conda activate base


POST WAS EDITED TO WORK WITH MODERN REMBG

And if I put this in the GEGL command
boy:bash input="GEGL_IN" output="GEGL_OUT" pipeline="source ~/anaconda3/etc/profile.d/conda.sh && conda activate base && rembg -p GEGL_IN -o GEGL_OUT


nothing happens really, nothing in /tmp either

It would be really nice to have a working step by step example.
Only to get rembg to work ... nothing else. No fancy you can do this and that and so.
That only confuses me ( perhaps others, too)


Disable preview and try this.

boy:spawn path-in="/tmp/in.png" path-out="/tmp/out.png" pipeline="source ~/anaconda3/etc/profile.d/conda.sh && conda activate base && rembg i /tmp/in.png /tmp/out.png"




To make it go 9 times faster paste

buffer-sink layer src=/tmp/out.png


AFTER GIMP IS FROZE AND THE ORIGINAL COMMAND IS RUNNING


its tricky but you'll get the hang of it.


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

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Thu Dec 07, 2023 5:39 pm  (#28) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
contrast_ wrote:
nelo wrote:
very difficult to follow you for non-programmers :-(

What do I really have to write into the GEGL command?

in my normal working(!) bash script I activate the environment like so:
source ~/anaconda3/etc/profile.d/conda.sh
conda activate base


And if I put this in the GEGL command
boy:bash input="GEGL_IN" output="GEGL_OUT" pipeline="source ~/anaconda3/etc/profile.d/conda.sh && conda activate base && rembg -p GEGL_IN -o GEGL_OUT


nothing happens really, nothing in /tmp either

It would be really nice to have a working step by step example.
Only to get rembg to work ... nothing else. No fancy you can do this and that and so.
That only confuses me ( perhaps others, too)


Disable preview and try this.

boy:spawn path-in="/tmp/in.png" path-out="/tmp/out.png" pipeline="source ~/anaconda3/etc/profile.d/conda.sh && conda activate base && rembg /tmp/in.png -o /tmp/out.png"




To make it go 9 times faster paste

buffer-sink layer src=/tmp/out.png


AFTER GIMP IS FROZE AND THE ORIGINAL COMMAND IS RUNNING


its tricky but you'll get the hang of it.


That doesn't work for me here. It just leaves an empty layer, except for text in the upper left corner that reports "load failed".

The plugin by JamesH works perfectly however.
viewtopic.php?f=9&t=20041&start=30#p278034


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Thu Dec 07, 2023 6:51 pm  (#29) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
POST EDIT --- THE POST DID NOT RUN REMBG BECAUSE I WAS USING AN OUTDATED VERSION OF REMBG FROM EARLY 2022 AND THESE PEOPLE WERE USING A 2023 MODERN VERSION

Learn more about this here.
viewtopic.php?f=9&t=20652&start=60#p286226

--original post---

racer-x wrote:
contrast_ wrote:
nelo wrote:
very difficult to follow you for non-programmers :-(

What do I really have to write into the GEGL command?

in my normal working(!) bash script I activate the environment like so:
source ~/anaconda3/etc/profile.d/conda.sh
conda activate base


And if I put this in the GEGL command
boy:bash input="GEGL_IN" output="GEGL_OUT" pipeline="source ~/anaconda3/etc/profile.d/conda.sh && conda activate base && rembg -p GEGL_IN -o GEGL_OUT


nothing happens really, nothing in /tmp either

It would be really nice to have a working step by step example.
Only to get rembg to work ... nothing else. No fancy you can do this and that and so.
That only confuses me ( perhaps others, too)


Disable preview and try this.

boy:spawn path-in="/tmp/in.png" path-out="/tmp/out.png" pipeline="source ~/anaconda3/etc/profile.d/conda.sh && conda activate base && rembg i /tmp/in.png /tmp/out.png"




To make it go 9 times faster paste

buffer-sink layer src=/tmp/out.png


AFTER GIMP IS FROZE AND THE ORIGINAL COMMAND IS RUNNING


its tricky but you'll get the hang of it.


That doesn't work for me here. It just leaves an empty layer, except for text in the upper left corner that reports "load failed".

The plugin by JamesH works perfectly however.
viewtopic.php?f=9&t=20041&start=30#p278034


Make sure you are using non flatpak Linux and Please give me your unique rembg directory. This is the default for most people. So try this

1-5-2024 EDIT TO MODERNIZE ORIGINAL POST
boy:spawn path-in="/tmp/in.png" path-out="/tmp/out.png" pipeline=" rembg i /tmp/in.png /tmp/out.png  "


Guys you need to understand that this plugin is literally just calling bash in Linux. So whatever works in bash on Linux will work in this plugin. If you can call REMBG in bash on non-flatpak Gimp it will work here.


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

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Thu Dec 07, 2023 8:28 pm  (#30) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
I'm using Gimp PPA, not flatpak. rembg directory is "/home/user/.local/bin/rembg". it works fine via command line as well as python plugin. It doesn't seem to work in gegl graph using your script, at least not here.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Thu Dec 07, 2023 10:14 pm  (#31) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
If this worked on Windows, I wouldn't want to use rembg in Gegl anyway.
The expected result depends on the image type - but the JamesH plugin allows additional adjustments via mask (max. 20% adjustments - which is why a relatively slow plugin is better than manual selection).

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Fri Dec 08, 2023 2:29 am  (#32) 
Offline
GimpChat Member
User avatar

Joined: Sep 27, 2016
Posts: 345
Location: Germany, BW
Doesn't work for me either. Looks like described by MareroQ GIMP from PPA.
Starting GIMP from terminal gives some messages:
(gimp:6349): GLib-GObject-WARNING **: 19:34:37.509: value "NULL" of type 'gchararray' is invalid or out of range for property 'path-in' of type 'gchararray'

(gimp:6349): GLib-GObject-WARNING **: 19:34:37.509: value "NULL" of type 'gchararray' is invalid or out of range for property 'path-out' of type 'gchararray'
using gegl copy
sh: 1: source: not found
sh: 1: source: not found
sh: 1: source: not found
sh: 1: source: not found
sh: 1: source: not found
sh: 1: source: not found


rembg works fine here from my bash script, but not from that GEGL thingy.
I won't try any longer.

_________________
Regards
nelo

(Gimp 2.10 on Linux Mint MATE 20.1)


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Fri Dec 08, 2023 3:00 am  (#33) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
OUTDATED POST


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

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Fri Dec 08, 2023 3:04 am  (#34) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
racer-x wrote:
I'm using Gimp PPA, not flatpak. rembg directory is "/home/user/.local/bin/rembg". it works fine via command line as well as python plugin. It doesn't seem to work in gegl graph using your script, at least not here.


Try this once more and make sure it is ran inside GEGL Graph and replace "user" with your username.

This code was incorrect and was updated to be correct

boy:spawn path-in="/tmp/in.png" path-out="/tmp/out.png" pipeline=" rembg /tmp/in.png -o /tmp/out.png  "  "


Last edited by contrast_ on Fri Dec 08, 2023 7:30 am, edited 1 time in total.

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Fri Dec 08, 2023 6:02 am  (#35) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
contrast_ wrote:
racer-x wrote:
I'm using Gimp PPA, not flatpak. rembg directory is "/home/user/.local/bin/rembg". it works fine via command line as well as python plugin. It doesn't seem to work in gegl graph using your script, at least not here.


Try this once more and make sure it is ran inside GEGL Graph and replace "user" with your username.

boy:spawn path-in="/tmp/in.png" path-out="/tmp/out.png" pipeline=" /home/user/.local/bin/rembg /tmp/in.png -o /tmp/out.png  "


Tried that and same results. It just won't work here. It's also very slow to process compared to the JamesH plugin.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Fri Dec 08, 2023 7:26 am  (#36) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
POST EDIT --- THE POST ABOVE DID NOT RUN REMBG BECAUSE I WAS USING AN OUTDATED VERSION OF REMBG FROM EARLY 2022 AND THESE PEOPLE WERE USING A 2023 MODERN VERSION

Learn more about this here.
viewtopic.php?f=9&t=20652&start=60#p286226


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

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Fri Dec 08, 2023 6:07 pm  (#37) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
contrast_ wrote:
The commands I posted earlier did not work because I posted REMBG -o /tmp/output.png, now I added the original in.png in front.

These should work, high confidence. I feel stupid for wasting people's time.

if REMBG is in Local Bin
boy:spawn path-in="/tmp/in.png" path-out="/tmp/out.png" pipeline=" /home/user/.local/bin/rembg /tmp/in.png -o /tmp/out.png  "



If REMBG can be accessed just by typing REMBG in bash.
boy:spawn path-in="/tmp/in.png" path-out="/tmp/out.png" pipeline=" rembg /tmp/in.png -o /tmp/out.png  "



I feel silly that I was going wrong advice.


I tried both those scripts and got the same results. I'm beginning to think you're the only one that can make it work. Yes I only need to use REMBG in bash...

~$ rembg --version
rembg, version 2.0.50


Using rembg in commandline or JamesH plugin work just fine. I'm done playing with this, sorry.


Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Fri Dec 08, 2023 7:13 pm  (#38) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
POST EDIT --- THE POST DID NOT RUN REMBG BECAUSE I WAS USING AN OUTDATED VERSION OF REMBG FROM EARLY 2022 AND THESE PEOPLE WERE USING A 2023 MODERN VERSION

Learn more about this here.
viewtopic.php?f=9&t=20652&start=60#p286226

--original post---


racer-x wrote:
contrast_ wrote:
The commands I posted earlier did not work because I posted REMBG -o /tmp/output.png, now I added the original in.png in front.

These should work, high confidence. I feel stupid for wasting people's time.

if REMBG is in Local Bin
boy:spawn path-in="/tmp/in.png" path-out="/tmp/out.png" pipeline=" /home/user/.local/bin/rembg /tmp/in.png -o /tmp/out.png  "



If REMBG can be accessed just by typing REMBG in bash.
boy:spawn path-in="/tmp/in.png" path-out="/tmp/out.png" pipeline=" rembg /tmp/in.png -o /tmp/out.png  "



I feel silly that I was going wrong advice.


I tried both those scripts and got the same results. I'm beginning to think you're the only one that can make it work. Yes I only need to use REMBG in bash...

~$ rembg --version
rembg, version 2.0.50


Using rembg in commandline or JamesH plugin work just fine. I'm done playing with this, sorry.



I just realized I am using a version of REMBG from 2021 that I got off of a python website. I intentionally used an older versio.

It could be that the `rembg -i` command is replaced with something else in the newer version.


I am deeply sorry for wasting your time racer-x. I'll investigate and ask someone else to test it.

*update I don't know why it isn't working for some people and feel bad.


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

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Fri Dec 08, 2023 7:15 pm  (#39) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
OUTDATED POST


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

Top
 Post subject: Re: GEGL calls GMIC, REMBG, AIs or any bash string with Liam's bash pl
PostPosted: Sat Dec 09, 2023 1:44 am  (#40) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1440
REMBG COULD WORK IN THE CLOUD FROM ANY MACHINE LIKE THIS

I have not tested this on my machine as I don't know how to open ports but in theory REMBG can run in the cloud like this. Both on a local cloud or a designated website that someone has yet to make specifically for GEGL to Gimp.

boy:spawn path-in="input.png" path-out="output.png" pipeline=" curl -s "http://localhost:5000/api/remove?url=http://input.png" -o output.png
"


It would likely work by uploading an image to a website using a bash command then sleep for a few seconds or so for it to process then call back the output file in GEGL. This is totally possible if someone made a designated website not only for u2net/REMBG in the cloud but to access it via bash.


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