Re: Byte array to Image



On Fri, 2009-06-26 at 18:45 +0100, António Pinho wrote:

> Hi there! I have a byte array that is data from an image.. how can i
> turn that array of bytes into a jpeg or bmp image file?

If your byte array image data is in RGB format, you can create a
GdkPixbuf from it using

http://library.gnome.org/devel/gdk-pixbuf/stable/gdk-pixbuf-creating.html#gdk-pixbuf-new-from-data

and then use gdk_pixbuf_save() to save it as jpeg:

http://library.gnome.org/devel/gdk-pixbuf/stable/gdk-pixbuf-file-saving.html#gdk-pixbuf-save

 Cheers
  -Tim



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]