-
Notifications
You must be signed in to change notification settings - Fork 3
/
gegl.c
87 lines (65 loc) · 2.34 KB
/
gegl.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* compile with
gcc -g -Wall gegl.c `pkg-config gegl-0.4 --cflags --libs`
*/
#include <stdio.h>
#include <stdlib.h>
#include <gegl.h>
static void
null_log_handler (const gchar *log_domain,
GLogLevelFlags log_level,
const gchar *message,
gpointer user_data)
{
}
int
main (int argc, char **argv)
{
GeglNode *gegl, *load, *crop, *scale, *sharp, *save;
gegl_init (&argc, &argv);
if (argc != 3)
{
fprintf (stderr, "usage: %s file-in file-out\n", argv[0]);
exit (1);
}
g_log_set_handler ("GEGL-load.c",
G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
null_log_handler, NULL);
g_log_set_handler ("GEGL-gegl-tile-handler-cache.c",
G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
null_log_handler, NULL);
gegl = gegl_node_new ();
load = gegl_node_new_child (gegl,
"operation", "gegl:load",
"path", argv[1],
NULL);
crop = gegl_node_new_child (gegl,
"operation", "gegl:crop",
"x", 100.0,
"y", 100.0,
"width", 4800.0,
"height", 4800.0,
NULL);
scale = gegl_node_new_child (gegl,
"operation", "gegl:scale-ratio",
"x", 0.9,
"y", 0.9,
"sampler", GEGL_SAMPLER_LINEAR,
NULL);
sharp = gegl_node_new_child (gegl,
"operation", "gegl:unsharp-mask",
"std-dev", 1.0, // diameter 7 mask in gegl
NULL);
save = gegl_node_new_child (gegl,
"operation", "gegl:save",
//"operation", "gegl:png-save",
//"bitdepth", 8,
"path", argv[2],
NULL);
gegl_node_link_many (load, crop, scale, sharp, save, NULL);
//gegl_node_dump( gegl, 0 );
gegl_node_process (save);
//gegl_node_dump( gegl, 0 );
g_object_unref (gegl);
gegl_exit ();
return (0);
}