image.save

A generic error occurred in GDI+ when closing the memory stream or using 'using' with memory stream

below is my code which throws exception because i am using the 'using' statement with the memory stream, i.e. it gets disposed at the end and when i try to save the image it throws the exception. using(MemoryStream memoryStream = new MemoryStream()) { ImageCodecInfo imageEncoder = GetEncoderInfo("image/jpeg"); EncoderParameter...

Cannot use "image.save" on django

My error is: IOError at /mytest/photo/upload/ [Errno 2] No such file or directory: u'/mytest/photo/upload/2.png' And my view is: UPLOAD_URL = '/mytest/photo/upload/' def upload(request): buf = request.FILES.get('photo', None) print buf if buf: #data = buf.read() #f = StringIO.StringIO(data) image...

Error: A generic error occurred in GDI+ while saving the file

When I enter the full hard disk path as a parameter of the method Image.Save, I get no error and the file is being saved on the desired location. But I want the image saved inside Web project folder of the application so I use this code: myImage.Save(Server.MapPath("SomeApp.Web/report.png"), System.Drawing.Imaging.ImageFormat.Png); an...