I figured it out. I will not let this be a "PM'd you the fix
![Big Grin Big Grin](https://www.gimp-forum.net/images/smilies/biggrin.png)
" moment.
Code:
from gimpfu import *
import pygtk
import gtk
from sys import argv, platform
from ctypes import *
def load_library (library_name):
if platform == "linux" or platform == "linux2":
library_name = library_name + '.so.0'
elif platform == "win32":
from ctypes.util import find_library
library_name = find_library (library_name + "-0")
else:
raise BaseException ("TODO")
return CDLL (library_name)
gimp = load_library('libgimp-2.0')
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 ()
def emboss(timg, tdrawable, depth=4, elevation=12.5):
gegl_graph_string = "emboss azimuth=30.0 depth={0} elevation={1}".format(depth, elevation)
use_gegl_graph(timg, tdrawable, gegl_graph_string)
I don't remember where I got most of this code from, probably this forum.