Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am trying following code to save image files.
C#
Image img = new Bitmap(500, 500);
            Graphics g = Graphics.FromImage(img);

           
            Font font = new Font("Arial", 24);
            PointF drawingPoint = new PointF(10, 10);

            g.DrawString("Test Viprat", font, Brushes.Black, drawingPoint);

           
            img.Save(@"C:\Test Tiff\2.tiff", ImageFormat.Tiff);


I am getting exception in img.Save A generic error in GDI+.
Can any help me what is the problem?

Regards,
Viprat
Posted

1 solution

Check your access permissions on the "C:\Test Tiff" folder, and that there isn't an existing file of that name in use.

I tried your code locally with my temporary folder and it worked fine.
 
Share this answer
 
Comments
viprat 18-Nov-14 5:53am    
yes its working fine if i copy the code in other application. But its not working in my current project.
OriginalGriff 18-Nov-14 5:59am    
As I said: check the folder access permissions.
If that all looks fine, check the inner exception and see if there is anything there.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900