المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Bitmap "Invalid parameter"



C# Programming
06-16-2012, 02:10 AM
I have a PC with 12GB memory and the OS is win2008r2.

Now,I wanna merge serveral picese of jpg into one picese of jpg,but the vs2008 throw a error which messages "Invalid parameter".

How can I solve the problem?

My code like below:

Image finalImage= new Bitmap(30280, 48000);//this code causes the error "Invalid parameter".

Graphics MergeImage = Graphics.FromImage(finalImage);
DirectoryInfo theFolder = new DirectoryInfo(folder_path);

Image tempImage;
string[] index;
int i = 0;
int j = 0;

foreach (FileInfo NextFile in theFolder.GetFiles("*.jpg"))
{
tempImage = new Bitmap(folder_path + @"\" + NextFile.Name);
index = NextFile.Name.Split('.');
i = Convert.ToInt32(index[0]);
j = Convert.ToInt32(index[1]);
MergeImage.DrawImage(tempImage, new Point(j * captureWidth, i * captureHeight));
MergeImage.Flush();
tempImage.Dispose();
File.Delete(folder_path + @"\" + NextFile.Name);
}

123