Help with gegl:warp

I want to use the GEGL API to create a program with a “Move Pixels” warp functionality, like the “Warp Transform” function in GIMP. Below is my code. Strangely, when I run the program and provide a color image (the first image) as input, it produces an unexpected grayscale image (the second image). Does anybody know the reason? Advice would be extremely appreciated.

#include <gegl.h>
typedef enum
GIMP_WARP_BEHAVIOR_MOVE, /< desc=“Move pixels” >/
GIMP_WARP_BEHAVIOR_GROW, /< desc=“Grow area” >/
GIMP_WARP_BEHAVIOR_SHRINK, /< desc=“Shrink area” >/
GIMP_WARP_BEHAVIOR_SWIRL_CW, /< desc=“Swirl clockwise” >/
GIMP_WARP_BEHAVIOR_SWIRL_CCW, /< desc=“Swirl counter-clockwise” >/
GIMP_WARP_BEHAVIOR_ERASE, /< desc=“Erase warping” >/
GIMP_WARP_BEHAVIOR_SMOOTH /< desc=“Smooth warping” >/
} GimpWarpBehavior;

gint main (gint argc,
gchar **argv)
g_print(“warp 0\n”);
GeglNode *graph, *src, *sink, *warp, *invert, *invert2;
GeglBuffer *buffer = NULL;

GeglPath *stroke;

gegl_init (&argc, &argv);

stroke = gegl_path_new ();
gegl_path_append (stroke, ‘M’, 696.1, 496.5);
gegl_path_append (stroke, ‘L’, 796.2, 506.6);
g_print(“gegl_path_append stroke %s\n”, gegl_path_to_string (stroke));

graph = gegl_node_new ();
src = gegl_node_new_child (graph,
“operation”, “gegl:load”,
“path”, argv[1],
warp = gegl_node_new_child (graph,
“operation”, “gegl:warp”,
“strength”, 90.0,
“hardness”, 0.263,
“spacing”, 10.2,

sink = gegl_node_new_child (graph,
“operation”, “gegl:save”,
“path”, argv[2],

gegl_node_link_many (src, warp, sink, NULL);

gegl_node_process (sink);
g_object_unref (graph);

gegl_exit ();
return 0;

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.