[Mono-devel-list] In memory transform from byte[] to pixbuf

Chris Morgan cmorgan at alum.wpi.edu
Sat Oct 16 11:57:33 EDT 2004


From monodoc 'public Pixbuf (System.IO.Stream stream)'

/* buffer containing an image */
System.Byte[] buffer = new System.Byte[256];

/* create a memory stream to the buffer */
System.IO.MemoryStream memorystream = new System.IO.MemoryStream(buffer);    

/* create a pixbuf from the stream as if it was a file */
Gdk.Pixbuf pb = new Gdk.Pixbuf(memorystream);
  
Chris


On Friday 15 October 2004 8:49 pm, Phillip Neumann wrote:
> Hello.
>
> I got an jpeg image from a database:  (actually they are jpg, png and/or
> gifs)
>
> byte[] jpegpix
>
>
> i wish to create a pixbuf from that, so i can use it in Gtk widgets
>
> how would i do that, without writng the bits to a file, an load it like
> Pixbuf p = new Pixbuf ("file.jpg") ?
>
>
> thanks in advance!



More information about the Mono-devel-list mailing list