Raster starts

on 10 Mar 2011 by Mukund (@muks)

Raster is slowly able to do more things than compile. :)

Loading and saving PPM images:

in-ppm graph

in-ppm

Simple rectangle (r,g,b,a) => (1, 0, 0, 1):

in-rectangle graph

in-rectangle

Simple inversion:

op-invert graph

op-invert

Desaturation (corresponding to the 3 kinds in GIMP):

op-desaturate graph

op-desaturate

Value invert (corresponding to the one in GIMP):

op-value-invert
graph

op-value-invert

At least one person has said that this looks like GEGL. :) It isn't anything like GEGL, which is a far more powerful library. Raster is meant to be simple to write new ops for and simple to use. It doesn't do tiled processing, and the tree ROI are evaluated optimally as required by the function call stack. The lack of tiling won't be a significant memory problem for current sizes of digital photos, video frames, etc. with shallow trees. With deeper trees, one can flatten and cache results.

As an example, for the desaturated image above, the C code is:

#include <stdio.h>
#include <raster/raster.h>

int
main (int argc, char *argv[])
{
  RasterNode *n1;
  RasterNode *n2;

  n1 = raster_in_ppm ("max.ppm");
  n2 = raster_op_desaturate (n1, RASTER_OP_DESATURATE_LUMINOSITY);
  raster_node_unref (n1);

  raster_out_ppm (n2, "out3.ppm");

  printf ("exp: %s\n", raster_node_get_expr (n2));

  raster_node_unref (n2);

  return 0;
}