- Where Developers Learn, Share, & Build Careers
I have tried to convert binary data into image here here is my code:
Byte [] bytes = (byte []) (reader ["avatar"]); Fs1.Write (byte, 0, bytes lang); PictureBox1.Image = Image.FromFile ("image.jpg"); PictureBox1.SizeMode = PictureBox SizeMode.Stretch Image; PictureBox1.Refresh (); But the exception in the wrong line is out of memory: "pictureBox1.Image = Image.FromFile (" image.jpg ");" I do not know why this happens, please help me
Try this method: < / P>
public image image framebits (byte [] bytes) {(var ms = new memorystream (bytes)) {return Image.FromStream (ms); }}
Comments
Post a Comment