Save Image from Memorystream using C# and ASP.NET

KlokWorks

New Member
I am using a memory stream to resize an image through a FileUpload control. After it resizes it I want it to save to my filesystem at \[code\]"~/images/2012/" + filename\[/code\]. How do I save the image from a memorystream?\[code\]System.Drawing.Image imageLarge = System.Drawing.Image.FromStream(stream);System.Drawing.Image imageLarge1 = ResizeImage(imageLarge, 200, 300); MemoryStream memolarge = new MemoryStream(); imageLarge1.Save(memolarge, System.Drawing.Imaging.ImageFormat.Jpeg); System.Drawing.Image returnImage = System.Drawing.Image.FromStream(memolarge); Encoder myEncoder; EncoderParameter myEncoderParameter; EncoderParameters myEncoderParameters; myEncoder = Encoder.Quality; myEncoderParameter = new EncoderParameter(myEncoder, 100L); myEncoderParameters.Param[0] = myEncoderParameter; string convertedImage = returnImage.ToString(); returnImage.Save("~/images/2012/" + filename, ImageFormat.Jpeg, myEncoderParameters);\[/code\]This is the error I am getting along with an overloaded method error:\[code\]cannot convert from 'System.Drawing.Imaging.ImageFormat' to 'System.Drawing.Imaging.ImageCodecInfo\[/code\]
 
Back
Top