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

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -