Byte array to Image

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Byte array to Image

António Pinho
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?

Thank you

_______________________________________________
gtk-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re: Byte array to Image

Tim-Philipp Müller
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

_______________________________________________
gtk-list mailing list
[hidden email]
http://mail.gnome.org/mailman/listinfo/gtk-list