I want to resize the image in my website, but when I using Bitmap to load a image of 14032*19864(png extension), an OutOfMemoryException is thrown. My compiler configuration is any cpu.
I was doubting whether the running environment is x64.
the code is below:
public ActionResult BimDWGViewer()
{
    Viewer.Uri uri = null;
    string url = Request.Params["u"];
    uri = new Viewer.Uri("image@"+url);
    int width = Int32.Parse(Request.Params["w"]);
    int height = Int32.Parse(Request.Params["h"]);
    Nebula.Nexus.Helpers.ModelUriTranslator.TranslateUri(uri);
    if (uri.IsFileProtocol)
    {
        string path = uri.Path;
        System.Drawing.Bitmap image_source = new System.Drawing.Bitmap(path);
        System.Drawing.Bitmap image_result = new System.Drawing.Bitmap(width,height);
        using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image_result))
        {
            g.DrawImage(image_source, new System.Drawing.Rectangle(0, 0, width, height), new System.Drawing.Rectangle(0, 0, image_source.Width, image_source.Height), System.Drawing.GraphicsUnit.Pixel);
        }
        MemoryStream output = new MemoryStream();
        image_result.Save(output, System.Drawing.Imaging.ImageFormat.Png);
        byte[] res = output.ToArray();
        output.Dispose();
        image_source.Dispose();
        image_result.Dispose();
        return new FileContentResult(res, "image/png");
    }
}
The exception occurs in the line of
System.Drawing.Bitmap image_source = new System.Drawing.Bitmap(path);
 
     
     
    