Posted on: 10/5/2013 4:40:20 AM | Views : 600

I call below function to resize my images.  Now getting 'Out of memory' exception on line (roughly middle in below code)-
Graphics newImage = Graphics.FromImage(temp);
Not sure what I need to do.. I even tried 'using' clause unsuccessfully.  The Jpg image that I am trying to resize is 264kb (1361px X 1628px) .. I am resizing to new width of 540 keeping aspect ratio.
Can someone please guide/help?  If someone has another solution, let me knw.. please.

public static void ResizeImageWithAspect(string fileName, string outputFileName, int newWidth) { //System.Drawing.Imaging.ImageCodecInfo codec = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders()[1]; //System.Drawing.Imaging.EncoderParameters eParams = new EncoderParameters(1); //eParams.Param[0] = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, Convert.ToInt64(System.Configuration.Con ...

Go to the complete details ...