GEGL graph - Pocholo - 01-31-2022
I hope I get a fix using the "Gegl" command line 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') from one of the Gegl expert here.
When I use Gegl graph, the procedure work fine and it give me the Solid Noise...
(Click the link to see image)
https://imgur.com/a/kteCJwE
But when I run the plugin it doesn't give me the same result, it just give me the created white layer.
(Click the link to see image)
https://imgur.com/a/69ErYDl
As you see in the code, I used the "gegl Bump-map" (Line 75-76) and this one work with no problem.
But the "gegl Solid Noise" (Line100) there is no action.
Thank you in advance!
This is my plugin code:
Code:
1 When I use Gegl graph, the procedure work fine and it give me the Solid Noise...
2 https://imgur.com/a/kteCJwE
3
4 But when I run the plugin it doesn't give me the same result, it just give me the created white layer.
5 I used the "gegl_command.py" that is made up of paynekj's simpler version.
6
7 https://imgur.com/a/69ErYDl
8
9 #!/usr/bin/env python
10 # -*- coding: utf-8 -*-
11
12 # author: Pocholo
13 # date: 8/18/21
14
15 # Comments directed to http://gimpchat.com
16
17 # Installation:
18 # This script should be placed in the user plugin folder
19
20 # Copyright (C)
21
22 # This program is free software: you can redistribute it and/or modify
23 # it under the terms of the GNU General Public License as published by
24 # the Free Software Foundation, either version 3 of the License, or
25 # (at your option) any later version.
26
27 # This program is distributed in the hope that it will be useful,
28 # but WITHOUT ANY WARRANTY; without even the implied warranty of
29 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 # GNU General Public License for more details.
31 #
32 # You should have received a copy of the GNU General Public License
33 # along with this program. If not, see <https://www.gnu.org/licenses/>.
34
35 from gimpfu import *
36 import os, sys,time
37 import gettext
38 gettext.install("gimp20", gimp.locale_directory, unicode=True)
39
40 def create_a_beautiful_moonlight_scene():
41
42 pdb.gimp_context_push()
43 pdb.gimp_context_set_defaults()
44
45 #Create the sky
46 img = pdb.gimp_image_new(1920, 1080, RGB)
47 Starslayer = pdb.gimp_layer_new(img, img.width, img.height, RGBA_IMAGE, "Small Stars", 100, LAYER_MODE_NORMAL)
48 pdb.gimp_image_insert_layer(img, Starslayer, None, 0)
49 pdb.gimp_layer_add_alpha(Starslayer)
50 pdb.gimp_context_set_foreground((0, 0, 0))
51 pdb.gimp_drawable_fill(Starslayer, FILL_FOREGROUND)
52
53 #Image process
54 pdb.gimp_display_new(img)
55
56 #Create the stars
57 pdb.plug_in_hsv_noise(img, Starslayer, 8, 0, 0, 255)
58 pdb.gimp_brightness_contrast(Starslayer, -80, 50)
59 pdb.plug_in_gauss(img, Starslayer, 0.50, 0.50, 1)
60 pdb.plug_in_sparkle(img, Starslayer, 0.001, 1.00, 20, 4, 15, 1.00, 0, 0, 0, FALSE, FALSE, FALSE, 0)
61
62 #Create the Moon
63 moonLayer = pdb.gimp_layer_new(img, img.width, img.height, RGBA_IMAGE, "Moon", 100, LAYER_MODE_NORMAL)
64 pdb.gimp_image_add_layer(img, moonLayer, 0)
65 pdb.gimp_drawable_fill(moonLayer, FILL_TRANSPARENT)
66 pdb.gimp_context_set_foreground("White")
67 pdb.gimp_image_select_ellipse(img, 2, 810, 75, 306, 306)
68 pdb.gimp_edit_bucket_fill(moonLayer, BUCKET_FILL_FG, LAYER_MODE_NORMAL, 100, 255, FALSE, 0, 0)
69 pdb.plug_in_solid_noise(img, moonLayer, FALSE, FALSE, 0, 15, 0.8, 0.8)
70 pdb.gimp_selection_none(img)
71
72 #Create a texture on the moon
73 pdb.gimp_file_save(img, moonLayer, "C:\\temp\\Moon.png", "Moon.png")
74 moonLayer=pdb.gimp_image_get_active_layer(img)
75 pdb.python_gegl(img, moonLayer,
76 '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')
77 pdb.gimp_image_select_item(img, 2, moonLayer)
78 pdb.gimp_selection_shrink(img, 6)
79 pdb.gimp_selection_invert(img)
80 pdb.gimp_drawable_edit_clear(moonLayer)
81
82 #Moon glow
83 glowLayer = pdb.gimp_layer_new(img, img.width, img.height, RGBA_IMAGE, "Moon glow", 100, LAYER_MODE_NORMAL_LEGACY)
84 pdb.gimp_image_add_layer(img, glowLayer, 1)
85 pdb.gimp_drawable_fill(glowLayer, FILL_TRANSPARENT)
86 pdb.gimp_context_set_foreground("White")
87 pdb.gimp_image_select_item(img, 2, moonLayer)
88 pdb.gimp_edit_bucket_fill(glowLayer, BUCKET_FILL_FG, LAYER_MODE_NORMAL, 100, 255, FALSE, 0, 0)
89 pdb.gimp_selection_none(img)
90 pdb.plug_in_gauss(img, glowLayer, 150, 150, 1) #method=1
91
92 #Create the sea
93 seaLayer = pdb.gimp_layer_new(img, img.width, img.height, RGBA_IMAGE, "Sea", 100, LAYER_MODE_NORMAL)
94 pdb.gimp_image_add_layer(img, seaLayer, 0)
95 pdb.gimp_context_set_foreground((3, 3, 5))
96 pdb.gimp_drawable_fill(seaLayer, FILL_FOREGROUND)
97 wavesLayer = pdb.gimp_layer_new(img, img.width, img.height, RGBA_IMAGE, "Waves", 100, LAYER_MODE_NORMAL)
98 pdb.gimp_image_add_layer(img, wavesLayer, 0)
99 pdb.gimp_drawable_fill(wavesLayer, FILL_WHITE)
100 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')
101
102 #Make active the bottom layer and done
103 pdb.gimp_image_set_active_layer(img, Starslayer)
104
105 #Set gimp to default
106 pdb.gimp_context_pop()
107
108 register(
109 "create_a_beautiful_moonlight_scene",
110 "Creates Stars and a Moon",
111 "Creates Stars and a Beautiful Moonlight over a Sea",
112 "Pocholo",
113 "Pocholo",
114 "2021",
115 "Create a Beautiful Moonlight Scene",
116 "",
117 [
118 ],
119 [],
120 create_a_beautiful_moonlight_scene, menu="<Image>/Pocholo-scripts/Beautiful Moonlight scene",
121 domain=("gimp20", gimp.locale_directory))
122 main()
RE: GEGL graph - rich2005 - 02-01-2022
Quote: As you see in the code, I used the "gegl Bump-map" (Line 75-76) and this one work with no problem. But the "gegl Solid Noise" (Line100) there is no action.
It looks like it is broken. A simple test using the gegl_command.py plugin interactively (not in a script) gives this error. a straight noise-solid should use the defaults and give a result.
gimp: Gimp-Core-CRITICAL: gimp_drawable_merge_shadow_buffer: assertion 'GEGL_IS_BUFFER (drawable->private->shadow)' failed
..but you already use pdb.plug_in_solid_noise on line 69, do you really need GEGL ?
RE: GEGL graph - Pocholo - 02-01-2022
(02-01-2022, 12:08 PM)rich2005 Wrote: Quote: As you see in the code, I used the "gegl Bump-map" (Line 75-76) and this one work with no problem. But the "gegl Solid Noise" (Line100) there is no action.
It looks like it is broken. A simple test using the gegl_command.py plugin interactively (not in a script) gives this error. a straight noise-solid should use the defaults and give a result.
gimp: Gimp-Core-CRITICAL: gimp_drawable_merge_shadow_buffer: assertion 'GEGL_IS_BUFFER (drawable->private->shadow)' failed
..but you already use pdb.plug_in_solid_noise on line 69, do you really need GEGL ?
Thank you for testing the code, rich2005. Yes I did used the old Solid Noise. I wanted to start learning and using the "Gegl" in this plugin for a near future reference. I know that probably with the next GIMP version we won't by able to use the old plugins
|