Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The image i trying to convert into bitmap is of size 36.7 MB and having dimensions
29696 x 4381.

I am posting my code below:

What I have tried:

try
{

C#
FileStream fs = new FileStream(FilePath,FileMode.Open,FileAccess.Read);

               System.Drawing.Image objImage = System.Drawing.Image.FromStream(fs);//From File

               int height = objImage.Height;//Actual image width
               int width = objImage.Width;//Actual image height
               LineNumber = 1;


               System.Drawing.Bitmap bitmapimage = new System.Drawing.Bitmap(objImage, width, height);// create bitmap with same size of Actual image.Getting error on this line


}
catch(Exception ex)
{
}
Posted
Comments
Bernhard Hiller 11-Nov-16 2:44am    
29696 x 4381 makes about 130 million pixels. With a 32bit ARGB bitmap (i.e. 4 byte per pixel), that makes half a Gigabyte. Well, hm, there could be a problem with that...
dattaprasaddhuri 11-Nov-16 4:00am    
Yes.That is the problem.Don't know how to resolve it.

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