It is currently Tue Jul 02, 2024 3:34 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 97 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Tue Nov 21, 2023 1:05 am  (#61) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1455
MareroQ wrote:
Changes in Ver.2:

- combined into one file gegl-python-fu.py and gegl-graph.py to gegl-python-fu & gegl-graph.py (standalone files: gegl-python-fu.py and gegl-graph.py must be deleted),
- change menu location (You can change it very quickly as you want using Notepad++),
- removed gegl-tile (because it doesn't work), gegl-nop (No operation),
- added: bump-map, component_extract, dropshadow, embos, mosaic, supernova.
- added: "Additional Information"
[ Image ]

A little about bump-map:

- bump-map: https://gegl.org/operations/gegl-bump-map.html
- about GEGL graph by Kevin and Tmanni: https://www.gimp-forum.net/Thread-GEGL- ... 0#pid19960. This was crucial to solving the aux problem - save aux.
- chanche offset: '+' up/right, '-' down/left
- gegl_graph_string + aux does not accept commas (that was problem number 2 but I don't know why at all),

I think that the save method (assuming that the 'd:' drive exists) will allow the conversion of filters from 2 pads: aux2 aux.
Tim wrote about 3 pads - which filter is it?

Edit:
Version 2.0 has been removed due to detected bugs
Reported bugs have been fixed in version 2.1 #55

I see you removed gegl:nop, Its okay to remove it from the GUI (where the user sees stuff) but that operation (gegl:nop) is critical to make connnections in GEGL known as id and ref. Many plugins of mine depend on gegl:nop to do this.

To put things simple gegl:nop exist to put filters inside blend modes while calling a copy of the original image.


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Tue Nov 21, 2023 4:56 am  (#62) 
Offline
GimpChat Member
User avatar

Joined: Sep 27, 2016
Posts: 345
Location: Germany, BW
MareroQ wrote:
I'm looking for a Bump-map tester on Linux (included in version 2.1) - my Ubuntu doesn't work (temporarily?) after updating.


Bumpmap doesn't work on my Linux Mint 20.1
The message I get is this:
Traceback (most recent call last):
  File "/usr/lib/gimp/2.0/python/gimpfu.py", line 741, in response
    dialog.res = run_script(params)
  File "/usr/lib/gimp/2.0/python/gimpfu.py", line 362, in run_script
    return apply(function, params)
  File "/home/xxx/.config/GIMP/2.10/plug-ins/gegl-python-fu & gegl_graph.py", line 1865, in gegl_bump_map
    pdb.file_png_save(image, save, xchange, xchange, 1, 1, 1, 0, 0, 1, 0, run_mode=RUN_NONINTERACTIVE)
RuntimeError: Datei »/usr/image_1.png« konnte nicht zum Schreiben geöffnet werden: Keine Berechtigung


Looks like it wants to write to /usr where it has no permisssions.
A user's home dir would be /home/username in Linux

_________________
Regards
nelo

(Gimp 2.10 on Linux Mint MATE 20.1)


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Tue Nov 21, 2023 5:48 am  (#63) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Hello Contrast
Plugin gegl-python-fu & gegl_graph.py is a helper for people writing plugins or scripts, and I don't see any way to use gegl:nop outside of Gegl proper.
Single Gegl plugins are registered in the PDB and this is very good, but if you only want to use one operation, it is better to use GEGL directly (advantage in preview).
Practically, gegl-python-fu & gegl_graph.py does not need to be registered in the Gimp menu at all (only in the PDB).
I assume plugin developers have knowledge of how to use gegl-python.

What do you think about not registering gegl-python-fu in menus (except gegl-graph)???

Hello Nelo.
Thank you for trying the plugin.
The idea behind this game is to temporarily save the Aux image in a location that will be publicly available to users of different versions of Linux.
Could you try with the tmp folder (replace "/usr/image_1.png" twice with "/tmp/image_1.png")

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Tue Nov 21, 2023 6:49 am  (#64) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2436
I am probably missing something in the discussion but it works ok here: kubuntu 20.04 / Gimp 2.10.36 (from PPA)

Attachment:
bump.jpg
bump.jpg [ 85.71 KiB | Viewed 15504 times ]


Lots of output in a terminal but no error messages

_________________
Image


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Tue Nov 21, 2023 8:57 am  (#65) 
Offline
GimpChat Member
User avatar

Joined: Sep 27, 2016
Posts: 345
Location: Germany, BW
Quote:
Could you try with the tmp folder (replace "/usr/image_1.png" twice with "/tmp/image_1.png")


Yes, that works

_________________
Regards
nelo

(Gimp 2.10 on Linux Mint MATE 20.1)


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Wed Nov 22, 2023 12:49 am  (#66) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Thank you very much Nelo and Rich2005 for testing.
We can always rely on you. :hi5

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Wed Nov 22, 2023 11:03 am  (#67) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1455
I tried adding a special version of my glossy balloon plugin designated for python all by myself and the .py file failed to load.

This is what I put

#-------------------------------------Beaver-----------------------------------------------------   

def gegl_glossy_balloon(image, layer, gaus,hue,lightness,opacityall):


    gegl_graph_string="lb:script-glossy-balloon gaus=%f hue=%f lightness=%f opacityall=%f" % (gaus, hue, lightness, opacityall)
    pdb.python_fu_gegl_graph(image, layer, gegl_graph_string)

register(
    "python_fu_gegl_glossy_balloon",
    "GEGL to Python. Works on the active layer",
    "Glossy Balloon GEGL Text Styling Plugin In Python",
    "Auto Author",
    "Auto Author",
    "Auto Generated Dated",
    "<Image>/GEGL as Python/gegl-glossy-balloon...",             #Menu path
    "*",
    [
    (PF_FLOAT, "gaus","gaus (default:6.0, 0.5..20.0):", 6.0),
    (PF_FLOAT, "hue","hue (default:0, -180..180.0):", 0),
    (PF_FLOAT, "lightness","lightness (default:-7, -15.0..15.0):", -7)
    (PF_FLOAT, "opacityall","opacityall (default:0.0, 1.0..5.0):", 3.0)

    ],
    [],
    gegl_glossy_balloon)

#---------------------------------------------------------------------------------------------


What did I do wrong? Here are the parameters of the filter I cited.
https://github.com/LinuxBeaver/Special_ ... ipt-only.c



THIS DOES NOT WORK


The plan should be to make the 24 compatible plugins of mine a separate python file that ships on said Github page of mine. I'll do it myself (all 24 of them) if someone teaches me how to get my plugins in python correctly.


Last edited by contrast_ on Wed Nov 22, 2023 5:30 pm, edited 1 time in total.

Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Wed Nov 22, 2023 1:38 pm  (#68) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
@Beaver.

If you add a comma (missing) after the line:
     (PF_FLOAT, "lightness","lightness (default:-7, -15.0..15.0):", -7)

everything works (but why without PF_COLOR?)


Attachments:
GB.jpg
GB.jpg [ 58.27 KiB | Viewed 15466 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Wed Nov 22, 2023 5:24 pm  (#69) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1455
Thank you Mr.Q I got it working and I plan to port my 24 plugins to python all by myself.

But should I have them as my own .c file called geglplugins.py, but if so they'd still need to be in your menu. I could have parenthesis with (plugin) after them.


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Wed Nov 22, 2023 5:29 pm  (#70) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1455
MareroQ wrote:
@Beaver.

If you add a comma (missing) after the line:
     (PF_FLOAT, "lightness","lightness (default:-7, -15.0..15.0):", -7)

everything works (but why without PF_COLOR?)


The script version of glossy balloon only has a hue rotation. (-180 - 180) from gegl:hue-chroma. The color node in the modern version of Glossy Balloon uses gimp:layer-mode layer-mode=hsl-color and that node does not work in gegl_command.py


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Wed Nov 22, 2023 8:47 pm  (#71) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1455
This code causes the python script to not show up at all in Gimp.

What did I do wrong?
Corresponds too
https://github.com/LinuxBeaver/Special_ ... t_cbevel.c

I used PF_OPTION for the drop down list of blend modes and intentionally excluded some options.


def gegl_custom_bevel(image, layer, opacity,blendmode,azimuth,elevation,depth,size,alphapercentile,gaus,box,mcb):


    if type==0:
        blendmode= "Hardlight"
    if type==1:
        blendmode= "Multiply"
    if type==2:
        blendmode= "ColorDodge"
    if type==3:
        blendmode= "Plus"
    if type==4 :
        blendmode= "Darken"
    if type==5 :
        blendmode= "Lighten"
    if type==6:


    gegl_graph_string="lb:script-custom-bevel opacity=%f blendmode=%f azimuth=%f elevation=%f depth=%f size=%f alphapercentile=%f gaus=%f box=%f mcb=%f" % (opacity, blendmode, azimuth, elevation, depth, size, alphapercentile, gaus, box, mcb)
    pdb.python_fu_gegl_graph(image, layer, gegl_graph_string)

register(
    "python_fu_gegl_custom_bevel",
    "GEGL to Python. Works on the active layer",
    "Custom Bevel GEGL Text Styling Plugin In Python",
    "Auto Author",
    "Auto Author",
    "Auto Generated Dated",
    "<Image>/GEGL as Python/gegl-glossy-balloon...",             #Menu path
    "*",
    [
    (PF_FLOAT, "opacity","opacity (default:1.0, 3.5 10.0):", 3.5),
    (PF_OPTION,  "blendmode",      "blendmode:", 0, ["Hardlight","Multiply","ColorDodge","Plus","Darken","Lighten"]),
    (PF_FLOAT, "azimuth","azimuth (default:67, 30 90.0):", 67),
    (PF_FLOAT, "elevation","elevation (default:25, 7 90):", 25),
    (PF_FLOAT, "depth","depth (default:24, 1 100):", 24),
    (PF_FLOAT, "size","size (default:1, 0 15):", 1),
    (PF_FLOAT, "alphapercentile","alphapercentile (default:68, 0 100):", 68),
    (PF_FLOAT, "gaus","gaus (default:2, 0 9):", 2),
    (PF_FLOAT, "box","box (default:0, 0 6):", 0),
    (PF_FLOAT, "mcb","mcb (default:0, 0 6):", 1),

    ],
    [],
    gegl_custom_bevel)


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Wed Nov 22, 2023 9:47 pm  (#72) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1455
I got custom bevel working but every blend mode I choose is exactly the same.

how do I get it to switch blend modes

Image

CODE HERE
def gegl_custom_bevel(image, layer, opacity,blendmode,azimuth,elevation,depth,size,alphapercentile,gaus,box,mcb):


    if blendmode==1:
        type= "Hardlight"
    if blendmode==2:
        type= "Multiply"
    if blendmode==3:
        type= "ColorDodge"
    if blendmode==4:
        type= "Plus"
    if blendmode==5:
        type= "Darken"
    if blendmode==6:
        type= "Lighten"



    gegl_graph_string="lb:script-custom-bevel opacity=%f blendmode=%f azimuth=%f elevation=%f depth=%f size=%f alphapercentile=%f gaus=%f box=%f mcb=%f" % (opacity, blendmode, azimuth, elevation, depth, size, alphapercentile, gaus, box, mcb)
    pdb.python_fu_gegl_graph(image, layer, gegl_graph_string)

register(
    "python_fu_gegl_custom_bevel",
    "GEGL to Python. Works on the active layer",
    "Custom Bevel GEGL Text Styling Plugin In Python",
    "Auto Author",
    "Auto Author",
    "Auto Generated Dated",
    "<Image>/GEGL as Python/gegl-custom-bevel...",             #Menu path
    "*",
    [
    (PF_FLOAT, "opacity","opacity (default:1.0, 3.5 10.0):", 3.5),
    (PF_OPTION,  "blendmode",      "blendmode:", 0, ["Hardlight","Multiply","ColorDodge","Plus","Darken","Lighten"]),
    (PF_FLOAT, "azimuth","azimuth (default:67, 30 90.0):", 67),
    (PF_FLOAT, "elevation","elevation (default:25, 7 90):", 25),
    (PF_FLOAT, "depth","depth (default:24, 1 100):", 24),
    (PF_FLOAT, "size","size (default:1, 0 15):", 1),
    (PF_FLOAT, "alphapercentile","alphapercentile (default:68, 0 100):", 68),
    (PF_FLOAT, "gaus","gaus (default:2, 0 9):", 2),
    (PF_FLOAT, "box","box (default:0, 0 6):", 0),
    (PF_FLOAT, "mcb","mcb (default:0, 0 6):", 1),

    ],
    [],
    gegl_custom_bevel)


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Wed Nov 22, 2023 9:49 pm  (#73) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1455
Also things like mcb and gaus are technical property names. I want to rename them to "internal gaussian blur" and "smooth". I think I know how to do that so I'll attempt to rename some things.


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Wed Nov 22, 2023 9:52 pm  (#74) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4001
Location: Canada
you're setting type.
don't know for sure but shouldn't you pass in like this as string for blendmode and pass in type
gegl_graph_string="lb:script-custom-bevel opacity=%f blendmode=%s azimuth=%f elevation=%f depth=%f size=%f alphapercentile=%f gaus=%f box=%f mcb=%f" % (opacity, type, azimuth, elevation, depth, size, alphapercentile, gaus, box, mcb)
    pdb.python_fu_gegl_graph(image, layer, gegl_graph_string)

_________________
TinT


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Wed Nov 22, 2023 10:59 pm  (#75) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1455
ok, I will change blend mode to %s instead of =%f. I also changed "type" to "blendmode" because custom bevel has no "type" property but it does have a "blendmode" property. Now lets see if it works


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Wed Nov 22, 2023 11:06 pm  (#76) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1455
I don't know how to solve this but here is the code. It works but the blend mode switcher is broke

def gegl_custom_bevel(image, layer, opacity, blend_mode,azimuth,elevation,depth,size,alphapercentile,gaus,box,mcb):


    if blend_mode==0:
        blendmode= "Hardlight"
    if blend_mode==1:
        blendmode= "Multiply"
    if blend_mode==2:
        blendmode= "ColorDodge"
    if blend_mode==3:
        blendmode= "Plus"
    if blend_mode==4:
        blendmode= "Darken"
    if blend_mode==5:
        blendmode= "Lighten"



    gegl_graph_string="lb:script-custom-bevel opacity=%f blendmode=%s azimuth=%f elevation=%f depth=%f size=%f alphapercentile=%f gaus=%f box=%f mcb=%f" % (opacity, blend_mode, azimuth, elevation, depth, size, alphapercentile, gaus, box, mcb)
    pdb.python_fu_gegl_graph(image, layer, gegl_graph_string)

register(
    "python_fu_gegl_custom_bevel",
    "GEGL to Python. Works on the active layer",
    "Custom Bevel GEGL Text Styling Plugin In Python",
    "Auto Author",
    "Auto Author",
    "Auto Generated Dated",
    "<Image>/GEGL as Python/gegl-custom-bevel...",             #Menu path
    "*",
    [
    (PF_FLOAT, "opacity","opacity (default:1.0, 3.5 10.0):", 3.5),
    (PF_OPTION,  "blend_mode", "blendmode:", 0, ["Hardlight","Multiply","ColorDodge","Plus","Darken","Lighten"]),
    (PF_FLOAT, "azimuth","azimuth (default:67, 30 90.0):", 67),
    (PF_FLOAT, "elevation","elevation (default:25, 7 90):", 25),
    (PF_FLOAT, "depth","depth (default:24, 1 100):", 24),
    (PF_FLOAT, "size","size (default:1, 0 15):", 1),
    (PF_FLOAT, "alphapercentile","alphapercentile (default:68, 0 100):", 68),
    (PF_FLOAT, "gaus","Internal Gaussian Blur (default:2, 0 9):", 2),
    (PF_FLOAT, "box","Internal Box Blur (default:0, 0 6):", 0),
    (PF_FLOAT, "mcb","Smooth (default:0, 0 6):", 1),

    ],
    [],
    gegl_custom_bevel)


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Wed Nov 22, 2023 11:20 pm  (#77) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4001
Location: Canada
I don't think it's broken but if you're setting now blendmode without underscore,
you should pass that in as
gegl_graph_string="lb:script-custom-bevel opacity=%f blendmode=%s azimuth=%f elevation=%f depth=%f size=%f alphapercentile=%f gaus=%f box=%f mcb=%f" % (opacity, blendmode, azimuth, elevation, depth, size, alphapercentile, gaus, box, mcb)

unless you're trying to pass the number in for blendmode, otherwise you want the string blendmode in the (opacity, blendmode ....) and not (opacity,blend_mode...)
that's why i put it as type before because you're trying to pass the variable you set with switch so I assume you're trying to pass that into the string so that after it formats it
you get opacity=%f with %f replace with opacity float variable.
and blendmode=%s with %s replaced with type string variable.
you can always pdb.gimp_message(gegl_graph_string) to debug it.
it's just setting a string
for example
mystring = "My age is %f and my name is %s" % (10,"Tin")

pdb.gimp_message(mystring) will show
My age is 10 and my name is Tin

_________________
TinT


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Wed Nov 22, 2023 11:30 pm  (#78) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4001
Location: Canada
also is the string supposed to be "blendmode=%s" or "blend_mode=%s"

_________________
TinT


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Thu Nov 23, 2023 12:31 am  (#79) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1455
ok, I got it. This works. Thanks


def gegl_custom_bevel(image, layer, opacity, blendmode, azimuth, elevation, depth, size, alphapercentile, gaus, box, mcb):


    if blendmode==0:
        blend_mode= "Hardlight"
    if blendmode==1:
        blend_mode= "Multiply"
    if blendmode==2:
        blend_mode= "ColorDodge"
    if blendmode==3:
        blend_mode= "Plus"
    if blendmode==4:
        blend_mode= "Darken"
    if blendmode==5:
        blend_mode= "Lighten"



    gegl_graph_string="lb:script-custom-bevel opacity=%f blendmode=%s azimuth=%f elevation=%f depth=%f size=%f alphapercentile=%f gaus=%f box=%f mcb=%f" % (opacity, blend_mode, azimuth, elevation, depth, size, alphapercentile, gaus, box, mcb)
    pdb.python_fu_gegl_graph(image, layer, gegl_graph_string)

register(
    "python_fu_gegl_custom_bevel",
    "GEGL to Python. Works on the active layer",
    "Custom Bevel GEGL Text Styling Plugin In Python",
    "Auto Author",
    "Auto Author",
    "Auto Generated Dated",
    "<Image>/GEGL as Python/gegl-custom-bevel...",             #Menu path
    "*",
    [
    (PF_FLOAT, "opacity","opacity (default:1.0, 3.5 10.0):", 3.5),
    (PF_OPTION,  "blend_mode", "blendmode:", 0, ["Hardlight","Multiply","ColorDodge","Plus","Darken","Lighten"]),
    (PF_FLOAT, "azimuth","azimuth (default:67, 30 90.0):", 67),
    (PF_FLOAT, "elevation","elevation (default:25, 7 90):", 25),
    (PF_FLOAT, "depth","depth (default:24, 1 100):", 24),
    (PF_FLOAT, "size","size (default:1, 0 15):", 1),
    (PF_FLOAT, "alphapercentile","alphapercentile (default:68, 0 100):", 68),
    (PF_FLOAT, "gaus","Internal Gaussian Blur (default:2, 0 9):", 2),
    (PF_FLOAT, "box","Internal Box Blur (default:0, 0 6):", 0),
    (PF_FLOAT, "mcb","Smooth (default:0, 0 6):", 1),

    ],
    [],
    gegl_custom_bevel)


Top
 Post subject: Re: GEGL operations exposed to Python-Fu - WIP 72 ops wrapped
PostPosted: Thu Nov 23, 2023 12:37 am  (#80) 
Offline
GimpChat Member
User avatar

Joined: Oct 31, 2020
Posts: 1455
btw, I could make a special version of the emboss filter that uses blend modes other then the default "multiply" that way you guys can have easier access to good bevel algorithms without having to learn how GEGL composers work.

id=1 blendmodehere aux=[ ref=1 emboss elevation= depth= azimuth= ]


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

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Make a key binding to access third party GEGL Operations faster

1

No new posts I'll make a filter based on other people's GEGL chain operations

1

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

1

No new posts Attachment(s) Requested plugin Christmas Wrapped Text

11

No new posts GIMP's fast pixel operations

4



* Login  



Powered by phpBB3 © phpBB Group