asp.net - Converting a byte array into an image -
i keep on getting gdi+ error whenever tempt save image in specified string path.. code: can advise please?
system.drawing.image newimage; byte[] b= (byte[])session["image"]; using (memorystream stream = new memorystream(b)) { newimage = system.drawing.image.fromstream(stream); newimage.save("c:\\test.png"); //this gdi+ error thrown image1.attributes.add("src", "c:\\test"); }
do need convert bytes image, , convert image bytes again?
otherwise can save bytes directly:
file.writeallbytes("c:\\test.png", (byte[])session["image"]);
Comments
Post a Comment