Update Portuguese translation
[gegl.git] / examples / gegl-convert.c
blob420155611a5355d43bf23a7566cd4edfc29a5781
1 #include <gegl.h>
3 gint
4 main (gint argc,
5 gchar **argv)
7 GeglNode *graph, *src, *sink;
8 GeglBuffer *buffer = NULL;
10 gegl_init (&argc, &argv);
12 if (argc != 3)
14 g_print ("GEGL based image conversion tool\n");
15 g_print ("Usage: %s <imageA> <imageB>\n", argv[0]);
16 return 1;
19 graph = gegl_node_new ();
20 src = gegl_node_new_child (graph,
21 "operation", "gegl:load",
22 "path", argv[1],
23 NULL);
24 sink = gegl_node_new_child (graph,
25 "operation", "gegl:buffer-sink",
26 "buffer", &buffer,
27 NULL);
29 gegl_node_link_many (src, sink, NULL);
31 gegl_node_process (sink);
32 g_object_unref (graph);
34 /* FIXME: Currently a buffer will always be returned, even if the source is missing */
35 if (!buffer)
37 g_print ("Failed to open %s\n", argv[1]);
38 return 1;
41 graph = gegl_node_new ();
42 src = gegl_node_new_child (graph,
43 "operation", "gegl:buffer-source",
44 "buffer", buffer,
45 NULL);
46 sink = gegl_node_new_child (graph,
47 "operation", "gegl:save",
48 "path", argv[2],
49 NULL);
51 gegl_node_link_many (src, sink, NULL);
53 gegl_node_process (sink);
54 g_object_unref (graph);
56 g_object_unref (buffer);
57 gegl_exit ();
58 return 0;