Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put image in a picture box from Bitmap

Tags:

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

This is the code I use to turn the byte[] array into a 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?

like image 309
Ivan Prodanov Avatar asked Apr 13 '09 10:04

Ivan Prodanov


People also ask

How do you add a picture to a picture box?

Right-click the folder, choose "Add existing item" and browse to your image (be sure the file filter is set to show image files). After adding the image, in the property sheet set the Copy to Output Directory to Copy if newer .


1 Answers

Have you tried this?

pictureBox.Image = bmp; 
like image 81
ChrisF Avatar answered Sep 28 '22 18:09

ChrisF