GEGL kaleidoscope - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions) +--- Thread: GEGL kaleidoscope (/Thread-GEGL-kaleidoscope) |
GEGL kaleidoscope - trandoductin - 01-10-2025 I looked at the gegl command.py and I have no clue how to make it so that I can call kaleidoscope... from python fu for GIMP 2.10 any help available? RE: GEGL kaleidoscope - teapot - 01-10-2025 (Yesterday, 01:24 AM)trandoductin Wrote: I looked at the gegl command.py I've used the kaleidoscope fine with gegl command in 2.10. The command is called mirrors. You can see the parameters it takes and their types here: https://gegl.org/operations/gegl-mirrors.html You make a string something like this (this example hasn't got all the parameters but their types are all straightforward double / int / boolean): mirrors n-segs=6 input-scale=100.00 o-x=0.04 clip=true However when I did it some time ago I thought offset and centre were mixed up. It may not be the case anymore but worth keeping a lookout for. The above link says: Offset X name: c-x Offset Y name: c-y Center X name: o-x Center Y name: o-y You call gegl command with parameters image, layer, gegl_string. RE: GEGL kaleidoscope - trandoductin - 01-10-2025 Thanks teapot. Do you have an example of how you call gegl command? I tried using the below found code but it's breaking for me. def use_gegl_graph(image, drawable, gegl_graph_string): class GeglBuffer(Structure): pass drawable_id = drawable.ID gegl = load_library ('libgegl-0.4') sucess = gegl.gegl_init (None, None) gimp.gimp_drawable_get_shadow_buffer.restype = POINTER (GeglBuffer) gimp.gimp_drawable_get_buffer.restype = POINTER (GeglBuffer) x = c_int (); y = c_int (); w = c_int (); h = c_int () non_empty,x,y,w,h = pdb.gimp_drawable_mask_intersect (drawable) args = [b"string", c_char_p (gegl_graph_string), c_void_p ()] if non_empty: source = gimp.gimp_drawable_get_buffer (drawable_id) target = gimp.gimp_drawable_get_shadow_buffer (drawable_id) sucess = gegl.gegl_render_op (source, target, "gegl:gegl", *args) gegl.gegl_buffer_flush (target) gimp.gimp_drawable_merge_shadow (drawable_id, PushUndo = True) gimp.gimp_drawable_update (drawable_id, x, y, w, h) gimp.gimp_displays_flush () RE: GEGL kaleidoscope - teapot - 01-10-2025 (Yesterday, 07:36 AM)trandoductin Wrote: Thanks teapot. Tricky, there are several versions floating around. I believe the original was by paynekj, Kevin Payne. I use the one below but I cannot remember where I got it. In my plugin I import it: import gegl_command and call it: gegl_command.gegl_command(image, layer, gegl_string) You can call it via the pdb but that's much slower: pdb.python_gegl(image, new_layer, gegl_string) EDIT: Do not use this version, see post #8. Code: #!/usr/bin/env python RE: GEGL kaleidoscope - trandoductin - 01-10-2025 There must be something wrong with windows. I can't get it to work on windows I had to do import ctypes from ctypes.util import find_library # This is the correct import if pl == 'win32': return ctypes.CDLL(find_library(lib + '-0')) This is now successful. RE: GEGL kaleidoscope - rich2005 - 01-10-2025 Well, as a non-coder, using Kevin's plugin gegl_command.py and a little shell script to call it, for_gegl.py That works in Windows 10 (VM) / Gimp 2.10.38 RE: GEGL kaleidoscope - trandoductin - 01-10-2025 Thanks to Kevin and teapot I was able to fulfill a request for client now just waiting to hear back from them. Maybe Windows 10 VM understood the ctypes.util, on mine it was complaining that there is not util attribute in ctypes and I asked chatGPT and chatGPT gave me that from ctypes.util import find_library code which works Not sure why it would blow up on me i mean it's the same thing (to me). Ah I noticed you attached a file rich and looked at it and for windows it's also doing the from ctypes.util import find_library so that would work (strange how that is to me). RE: GEGL kaleidoscope - teapot - 01-11-2025 (Yesterday, 01:28 PM)trandoductin Wrote: Thanks to Kevin and teapot I was able to fulfill a request for client now just waiting to hear back from them. There is a problem with the version I put in post #4, I only have Linux so didn't realise. I think changing just the import statement should fix it. If any Windows users could try the one below and say if it works that would be helpful. Thanks. Code: #!/usr/bin/env python RE: GEGL kaleidoscope - trandoductin - 01-11-2025 rich's attachment already tested in Windows 10 VM that works so yeah it is the import statement Tested post #8 - also successful on Windows 11 |