locked
Image isn't getting saved. A generic error occurred in GDI+. RRS feed

  • Question

  • User-1051844325 posted

    hi this is my code to saving the image.

    the error is as follows-

     

    A generic error occurred in GDI+.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.

    Source Error:

    Line 497:
    Line 498:
    Line 499:                large_b.Save(filename_large);
    Line 500:
    Line 501:                large_g.Dispose();
     

     

     

    HERE IS MY CODE-

    System.Drawing.Image thumbs_large= System.Drawing.Image.FromStream(file_add_image.PostedFile.InputStream);

    int imgwidth = (int) (thumb_large.PhysicalDimension.width);

    int imgheight = (int) (thumb_party).PhysicalDimension.Height);

    System.Drawing.Bitmap b=new System.Drawing.Bitmap(imgwidth, imgheight);

    System.Drawing.Graphics g = System.Drawing.Graphics.FromImage((System.Drawing.Bitmap)b);

    g.DrawImage(thumb_large, 0, 0, imgwidth, imgheight);

    b.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg);

    g.Dispose();

    b.Dispose();

     

    Kind help me out if i have done mistake.

     

     

     

     

     

     

     

     

    Thursday, October 15, 2009 4:13 AM

Answers