Skip to content

Instantly share code, notes, and snippets.

@automata
Created September 25, 2015 20:38
Show Gist options
  • Select an option

  • Save automata/e7854288184fa1c516f8 to your computer and use it in GitHub Desktop.

Select an option

Save automata/e7854288184fa1c516f8 to your computer and use it in GitHub Desktop.
GEGL code to load, rotate, crop and save an image. Use: ./foo in.png out.png. WIP!
#include <gegl.h>
#include <glib/gprintf.h>
gint
main (gint argc,
gchar **argv)
{
GeglNode *gegl,
*save,
*crop,
*rotate,
*load;
gegl_init (&argc, &argv); /* initialize the GEGL library */
gegl = gegl_node_new ();
save = gegl_node_new_child(gegl,
"operation", "gegl:save",
"path", argv[2],
NULL);
crop = gegl_node_new_child (gegl,
"operation", "gegl:crop",
"x", 10.0,
"y", 10.0,
"width", 400.0,
"height", 400.0,
NULL);
rotate = gegl_node_new_child(gegl,
"operation", "gegl:rotate-on-center",
"degrees", 90.0,
NULL);
load = gegl_node_new_child(gegl,
"operation", "gegl:load",
"path", argv[1],
NULL);
gegl_node_link_many (load, rotate, crop, save, NULL);
gegl_node_process (save);
g_object_unref (gegl);
gegl_exit ();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment