It is currently Sun Jun 30, 2024 1:30 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Inserting pdb.python_gegl command in my code
PostPosted: Sat Jan 29, 2022 5:45 pm  (#1) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Hi guys! I'm trying to implement a Gegl command in my code and it's not working :gaah .
Using the Bump map filter I have this:

pdb.python_gegl(img, layer,
   "bump-map type=linear compensate=True invert=False tiled=False azimuth=220 elevation=30 depth=20 offset-x=0 offset-y=0 waterlevel=1.00 ambient=1.00")


What am I missing here? Thank you in advance!

_________________
https://www.deviantart.com/pocholo17
Image


Last edited by Pocholo on Sun Jan 30, 2022 5:45 pm, edited 2 times in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Inserting pdb.python_gegl command in my code
PostPosted: Sat Jan 29, 2022 9:55 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Hi Pocholo.
Gegl bump-map needs aux input (need to save layer or use existing image with full path).
https://www.gimp-forum.net/Thread-GEGL- ... 1#pid19961
I don't know Your target, but it's easier to use gegl emboss like bump-map.

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code
PostPosted: Sat Jan 29, 2022 10:17 pm  (#3) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Thanks a lot MareroQ. Nice to see you still around here to help! :tyspin

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code (Solved)
PostPosted: Sat Jan 29, 2022 10:40 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Also for me it works when instead of: =False or =True You use =0 or =1 respectively.
Example:

def sample_bump(image, layer):
   xxx=pdb.gimp_image_get_active_layer(image)
   pdb.python_gegl(image, xxx, 'bump-map aux=[load path="d:/image.png"] compensate=1 invert=1 tiled=0 azimuth=220 elevation=30 depth=20 offset-x=30 offset-y=20')
   pdb.gimp_displays_flush()

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code (Solved)
PostPosted: Sat Jan 29, 2022 11:55 pm  (#5) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Thank you my friend! Believe it yourself, you're a good teacher! :hi5

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code (Solved)
PostPosted: Sun Jan 30, 2022 4:17 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Pocholo, could you post here the complete plug-in source of a python filter which makes use of pdb.python_gegl?

_________________
"Where am I ?"


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code (Solved)
PostPosted: Sun Jan 30, 2022 10:36 am  (#7) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Hi dinasset! I tryin to create a Night scene (Not finished yet). Can you check the Solid Noise gegl command? I thought I had this one right but is not applying to the image.


#!/usr/bin/env python
# -*- coding: utf-8 -*-

# author: Pocholo
# date: 8/18/21

# Comments directed to http://gimpchat.com

# Installation:
# This script should be placed in the user plugin folder

# Copyright (C)

#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by   
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.

#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <https://www.gnu.org/licenses/>.

from gimpfu import *
import os, sys,time
import gettext
gettext.install("gimp20", gimp.locale_directory, unicode=True)
               
def create_a_beautiful_moonlight_scene():

    #Initiates the temporary state
    pdb.gimp_context_push()
    pdb.gimp_context_set_defaults()
      
    #Create the sky
    img = pdb.gimp_image_new(1920, 1080, RGB)
    Starslayer = pdb.gimp_layer_new(img, img.width, img.height, RGBA_IMAGE, "Small Stars", 100, LAYER_MODE_NORMAL)
    pdb.gimp_image_insert_layer(img, Starslayer, None, 0)
    pdb.gimp_layer_add_alpha(Starslayer)
    pdb.gimp_context_set_foreground((0, 0, 0))
    pdb.gimp_drawable_fill(Starslayer, FILL_FOREGROUND)
   
    #Image process
    pdb.gimp_display_new(img)
   
    #Create the stars
    pdb.plug_in_hsv_noise(img, Starslayer, 8, 0, 0, 255)
    pdb.gimp_brightness_contrast(Starslayer, -80, 50)
    pdb.plug_in_gauss(img, Starslayer, 0.50, 0.50, 1)
    pdb.plug_in_sparkle(img, Starslayer, 0.001, 1.00, 20, 4, 15, 1.00, 0, 0, 0, FALSE, FALSE, FALSE, 0)
   
    #Create the Moon
    moonLayer = pdb.gimp_layer_new(img, img.width, img.height, RGBA_IMAGE, "Moon", 100, LAYER_MODE_NORMAL)
    pdb.gimp_image_add_layer(img, moonLayer, 0)
    pdb.gimp_drawable_fill(moonLayer, FILL_TRANSPARENT)
    pdb.gimp_context_set_foreground("White")
    pdb.gimp_image_select_ellipse(img, 2, 810, 75, 306, 306)
    pdb.gimp_edit_bucket_fill(moonLayer, BUCKET_FILL_FG, LAYER_MODE_NORMAL, 100, 255, FALSE, 0, 0)
    pdb.plug_in_solid_noise(img, moonLayer, FALSE, FALSE, 0, 15, 0.8, 0.8)
    pdb.gimp_selection_none(img)
   
    #Create a texture on the moon
    pdb.gimp_file_save(img, moonLayer, "C:\\temp\\Moon.png", "Moon.png")
    moonLayer=pdb.gimp_image_get_active_layer(img)
    pdb.python_gegl(img, moonLayer,
       'bump-map aux=[load path="C:\\temp\\Moon.png"] compensate=1 invert=0 tiled=0 azimuth=220 elevation=30 depth=7 offset-x=0 offset-y=0 waterlevel=1.00 ambient=1.00')
    pdb.gimp_image_select_item(img, 2, moonLayer)
    pdb.gimp_selection_shrink(img, 6)
    pdb.gimp_selection_invert(img)
    pdb.gimp_drawable_edit_clear(moonLayer)
   
    #Moon glow
    glowLayer = pdb.gimp_layer_new(img, img.width, img.height, RGBA_IMAGE, "Moon glow", 100, LAYER_MODE_NORMAL_LEGACY)
    pdb.gimp_image_add_layer(img, glowLayer, 1)
    pdb.gimp_drawable_fill(glowLayer, FILL_TRANSPARENT)
    pdb.gimp_context_set_foreground("White")
    pdb.gimp_image_select_item(img, 2, moonLayer)
    pdb.gimp_edit_bucket_fill(glowLayer, BUCKET_FILL_FG, LAYER_MODE_NORMAL, 100, 255, FALSE, 0, 0)
    pdb.gimp_selection_none(img)
    pdb.plug_in_gauss(img, glowLayer, 150, 150, 1)   #method=1
   
    #Create the sea
    seaLayer = pdb.gimp_layer_new(img, img.width, img.height, RGBA_IMAGE, "Sea", 100, LAYER_MODE_NORMAL)
    pdb.gimp_image_add_layer(img, seaLayer, 0)
    pdb.gimp_context_set_foreground((3, 3, 5))
    pdb.gimp_drawable_fill(seaLayer, FILL_FOREGROUND)
    wavesLayer = pdb.gimp_layer_new(img, img.width, img.height, RGBA_IMAGE, "Waves", 100, LAYER_MODE_NORMAL)
    pdb.gimp_image_add_layer(img, wavesLayer, 0)
    pdb.gimp_drawable_fill(wavesLayer, FILL_WHITE)
    pdb.python_gegl(img, wavesLayer, 'noise-solid x-size=16.00 y-size=16.00 detail=15 tileable=0 turbulent=0 seed=0 width=1920 height=1080')

    #Make active the bottom layer and done
    pdb.gimp_image_set_active_layer(img, Starslayer)
   
    #Set gimp to default
    pdb.gimp_context_pop()
      
register(
    "create_a_beautiful_moonlight_scene",
    "Creates Stars and a Moon",
    "Creates Stars and a Beautiful Moonlight over a Sea",
    "Pocholo",
    "Pocholo",
    "2021",
    "Create a Beautiful Moonlight Scene",
    "",
    [   
    ],
    [],
    create_a_beautiful_moonlight_scene, menu="<Image>/Pocholo-scripts/Beautiful Moonlight scene",
    domain=("gimp20", gimp.locale_directory))
main()         

_________________
https://www.deviantart.com/pocholo17
Image


Last edited by Pocholo on Tue Feb 01, 2022 11:46 am, edited 2 times in total.

Top
 Post subject: Re: Inserting pdb.python_gegl command in my code (Solved)
PostPosted: Sun Jan 30, 2022 11:01 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Downloaded and launched on my samj's Gimp, but I get this error message:
"Procedure 'python-gegl' not found".
What should I do?

_________________
"Where am I ?"


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code (Solved)
PostPosted: Sun Jan 30, 2022 11:10 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Stopping before "gegl" I get this image:
Attachment:
outcome_up_to_gegl.png
outcome_up_to_gegl.png [ 384.55 KiB | Viewed 826 times ]

_________________
"Where am I ?"


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code (Solved)
PostPosted: Sun Jan 30, 2022 4:46 pm  (#10) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Sorry I had to stepped out. Wi the first Bump-map "gegl" and the "Moon glow" this what you supposed to get with no error.
Image

After the glow I want to use Solid Noise "gegl" in a whole layer and I don't know what I'm missing in the this gegl
line. It does not produce anything when it should give me a layer filled with Solid Noise.

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code (Solved)
PostPosted: Sun Jan 30, 2022 5:44 pm  (#11) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
When I use Gegl graph, the procedure work fine and it give me the Solid Noise...

Image


But when I run the plugin it doesn't give me the same result, it just give me the created white layer.

Image

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code (Solved)
PostPosted: Sun Jan 30, 2022 6:01 pm  (#12) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
dinasset wrote:
Downloaded and launched on my samj's Gimp, but I get this error message:
"Procedure 'python-gegl' not found".
What should I do?


I used the "gegl_command.py" that is made up of paynekj's simpler version.

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code
PostPosted: Mon Jan 31, 2022 1:26 am  (#13) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Is it a separate .py plug-in? It's not embedded in your code.
Anyhow, I do not have "noise-solid" among the operations (C) I could test, hence I can't help.

edit: If you post here the separate .py plug-in, I can try to test your calls to the gegl functions

_________________
"Where am I ?"


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code
PostPosted: Mon Jan 31, 2022 8:29 am  (#14) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
In some way I had the possibility to try solid noise: you are right, Pocholo, no action, it could be the interface is broken.

_________________
"Where am I ?"


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code
PostPosted: Mon Jan 31, 2022 1:36 pm  (#15) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Hello, :)
The plugin that enables pdb.python-gegl is here.

_________________
Photo to cartoon : https://github.com/cl4cnam/gimp_cartoon_plugin


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code
PostPosted: Mon Jan 31, 2022 2:05 pm  (#16) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Thanks cli345, installed.
I'll see whether I can understand why some Pocholo calls do not execute properly (but I doubt, I'm not an expert).

_________________
"Where am I ?"


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code
PostPosted: Mon Jan 31, 2022 2:14 pm  (#17) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
That is the one I have installed, cli345. But the procedure "Solid Noise" is not working all all.
pdb.python_gegl(img, wavesLayer,
        'noise-solid x-size=16.00 y-size=16.00 detail=15 tileable=0 turbulent=0 seed=0 width=1920 height=1080')

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code
PostPosted: Mon Jan 31, 2022 3:16 pm  (#18) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Tested many types of noise, none works (not only noise-solid...).
Tested plasma, it works.

_________________
"Where am I ?"


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code
PostPosted: Tue Feb 01, 2022 7:43 am  (#19) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Also for me without success.
I tried out the noise-solid version of Cli, Kevin, Samj and Jehan (plug-in-goat-exercise-python for Gimp-2.99).
Of all the Gegl filters, only 85 work for me (using Python code).

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Inserting pdb.python_gegl command in my code
PostPosted: Tue Feb 01, 2022 11:43 am  (#20) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Thank you dinasset and MareroQ for taking the time to test "Gegl".

@MareroQ: Do you have the list of the Gegl filter that work? If you don't mind, Can you post the list? I'll thank you in advance. :)

_________________
https://www.deviantart.com/pocholo17
Image


Top
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Source Code for all my GEGL Filters

35

No new posts GEGL command line and layer modes?

2

No new posts Attachment(s) GEGL operations exposed to Python-Fu - WIP 72 ops wrapped

96

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

1

No new posts Attachment(s) GEGL "Glass over Text' is STAND ALONE BUT NOW PART OF GEGL EFFECTS

5



* Login  



Powered by phpBB3 © phpBB Group