- 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

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -