import Gegl gegl = Gegl.Node() gegl_load = gegl.new_child("gegl:load", path="gegl.png") bg_load = gegl.new_child("gegl:load", path="image.png") invert = gegl.new_child("gegl:invert") opacity = gegl.new_child("gegl:opacity", value=0.7) scale = gegl.new_child("gegl:scale", x=2.0, y=2.0) translate = gegl.new_child("gegl:translate", x=160.0, y=90.0) over = gegl.new_child("gegl:over") write = gegl.new_child("gegl:save", path="tmp.png") bg_load >> over >> write gegl_load >> invert >> opacity >> scale >> translate >> over["aux"] write.process()
#!/usr/bin/env python # -*- coding: utf-8 -*- #This is a Python version of the xmlanim.rb sample script written #by Øyvind Kolås for the Ruby binding (rgegl) of gegl. import Gegl gegl = Gegl.node_new_from_xml( """ <gegl> <gegl:display name='display'/> <gegl:crop x='0' y='145' width='400' height='200'/> <gegl:over> <gegl:translate x='20' y='170' name='translate'/> <gegl:gaussian-blur std_dev_x='10' std_dev_y='0' name='blur'/> <gegl:text string='pygegl' size='110' color='rgb(0.5,0.5,1.0)'/> </gegl:over> <gegl:fractal-explorer xmin='0.2' ymin='0' xmax='0.5' ymax='0.45' width='400' height='400'/> </gegl> """) display = gegl.lookup("display") frames=30 for frame in range(frames): gegl.lookup("translate").y = (frame*1.0)/frames*200.0 # display.process() frames=10 for frame in range(frames):
#!/usr/bin/env python # -*- coding: utf-8 -*- #This is a Python version of the op-reference.rb sample script written #by Øyvind Kolås for the Ruby binding (rgegl) of gegl. import Gegl import gobject operations = Gegl.list_operations() print "<html><body>" print "<ul>" for operation_name in operations: print "<li><a href='#%s'>%s</li>" % (operation_name, operation_name) print "</ul>" for operation_name in operations: print "<a name='%s'></a><h3>%s</h3>" % (operation_name, operation_name) print "<table>" for property in Gegl.list_properties(operation_name): if property.value_type == gobject.TYPE_DOUBLE: print "<tr><td>%s</td><td>%s</td><td>%s</td><td>min:%s max:%s default:%s</td></tr>" % ( property.value_type.name, property.name, property.blurb, property.minimum, property.maximum, property.default_value) else: print "<tr><td>%s</td><td>%s</td><td>%s</td></tr>" % ( property.value_type.name, property.name, property.blurb) print "</table>"
#!/usr/bin/env python # -*- coding: utf-8 -*- #This is a Python version of the op-reference.rb sample script written #by Øyvind Kolås for the Ruby binding (rgegl) of gegl. import Gegl import gobject operations = Gegl.list_operations() print "<html><body>" print "<ul>" for operation_name in operations: print "<li><a href='#%s'>%s</li>" % (operation_name, operation_name) print "</ul>" for operation_name in operations: print "<a name='%s'></a><h3>%s</h3>" % (operation_name, operation_name) print "<table>" for property in Gegl.list_properties(operation_name): if property.value_type == gobject.TYPE_DOUBLE: print "<tr><td>%s</td><td>%s</td><td>%s</td><td>min:%s max:%s default:%s</td></tr>" % (property.value_type.name, property.name, property.blurb, property.minimum, property.maximum, property.default_value) else: print "<tr><td>%s</td><td>%s</td><td>%s</td></tr>" % (property.value_type.name, property.name, property.blurb) print "</table>" print "</body></html>"
#!/usr/bin/env python # -*- coding: utf-8 -*- #This is a Python version of the subgraph.rb sample script written #by Øyvind Kolås for the Ruby binding (rgegl) of gegl. import Gegl from time import sleep gegl = Gegl.Node() # create a new GEGL graph fractal = gegl.new_child("gegl:fractal-explorer") unsharp = gegl.new_child("gegl:unsharp-mask") in_proxy = unsharp.get_input_proxy("input") out_proxy = unsharp.get_output_proxy("output") blur = unsharp.new_child("gegl:gaussian-blur", std_dev_x=5.0, std_dev_y=5.0) subtract = unsharp.new_child("gegl:subtract") add = unsharp.new_child("gegl:add") in_proxy >> subtract in_proxy >> add in_proxy >> blur >> subtract["aux"] >> add["aux"] >> out_proxy display = gegl.new_child("gegl:png-save", path="test.png") fractal >> unsharp >> display # connect the nodes display.process() sleep(2)