tags:

views:

1543

answers:

2

Is it possible to load a picture from memory(byte[] or stream or Bitmap) without saving it to the HDD

This is the code I use to turn the byte[] array into Bitmap

            unsafe
            {
                fixed (byte* ptr = Misc.ConvertFromUInt32Array(image))
                {
                    Bitmap bmp = new Bitmap(200,64,800,PixelFormat.Format32bppRgb,new IntPtr(ptr));
                    bmp.RotateFlip(RotateFlipType.Rotate180FlipX);
                    bmp.MakeTransparent(Color.Black);
                    bmp.Save("test.bmp");
                }
            }

Instead of using "Bmp.save()" ,can I put the Bitmap in the picture box on my form?

A: 

Yes, see sourcecode here: http://weblogs.asp.net/fbouma/archive/2005/12/25/433976.aspx

Frans Bouma
It didn't help me to find what I was searching for.
John
Strange, as I do what you ask there: I create a new bitmap from a byte array and use it inside a picture box! :)
Frans Bouma
+5  A: 

Have you tried this?

pictureBox.Image = bmp;
ChrisF
I just did it and it worked fine,thanks!
John