Just loop over the pixels and calculate a gray level through a linear
combination of R, G, and B. For example ppmtopgm uses:

grey = .299 r + .587 g + .114 b

Then assign the resulting gray to the red, green, and blue components, and
voila! You've got yourself a gray scale image.

See my previous post for an example of how to loop over a GdkPixbuf.

Regards,
Dov

2008/12/18 frederico schardong <frede....@gmail.com>

>  I need some API, which has the power to transform any RGB image to
> grayscale (8-bit) and I can map the image, creating a vast array[height in
> pixels][width in pixels] in which each cell has a value from 0 to 255,
> corresponding to the values of the pixels.
>
> With gdk-pixbuf can I do that?
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to