zimmer9
asked on
C# application error "Parameter Is Not Valid".
I am working on a C# application that merges the front and back of check images that are contained in 1 input file.
I have attached my application and a sample input file that is comprised of the front and back of 2 checks.
Do you know why I get the error:
Exception reported: System.ArgumentException: Parameter is not valid.
at System.Drawing.Image.Save( Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save( Stream stream, ImageFormat format)
at ReadBinary.Extensions.Merg eImages(IE numerable` 1 images, FileInfo file) in \\msad\Visual Studio 2015\Projects\Program.cs:l ine 87
It happens at:
line 87 -> image.Save(stream, ImageFormat.Tiff);
In the application I can successfully create the front and back of check images successfully as individual files using the following code but I can't merge the front and back of check images successfully and write the merged check images to a file:
MemoryStream ms = new MemoryStream(bytesFrImg, 0, bytesFrImg.Length);
ms.Write(bytesFrImg, 0, bytesFrImg.Length);
System.Drawing.Image image = System.Drawing.Image.FromS tream(ms, true);
image.Save("L:\\FINSYS\\FS Main\\C\\S ource\\" + DateTime.Now.ToString("yyy yMMdd.HHmm ss") +
MyGlobals.ctnumImg + "F.ard.out"); //, System.Drawing.Imaging.Ima geFormat);
MemoryStream ms1 = new MemoryStream(bytesBkImg, 0, bytesBkImg.Length);
ms1.Write(bytesBkImg, 0, bytesBkImg.Length);
System.Drawing.Image image1 = System.Drawing.Image.FromS tream(ms1, true);
image1.Save("L:\\FINSYS\\F SMain\\C\\ Source\\" + DateTime.Now.ToString("yyy yMMdd.HHmm ss") +
CheckImage.txt
sample.txt
I have attached my application and a sample input file that is comprised of the front and back of 2 checks.
Do you know why I get the error:
Exception reported: System.ArgumentException: Parameter is not valid.
at System.Drawing.Image.Save(
at System.Drawing.Image.Save(
at ReadBinary.Extensions.Merg
It happens at:
line 87 -> image.Save(stream, ImageFormat.Tiff);
In the application I can successfully create the front and back of check images successfully as individual files using the following code but I can't merge the front and back of check images successfully and write the merged check images to a file:
MemoryStream ms = new MemoryStream(bytesFrImg, 0, bytesFrImg.Length);
ms.Write(bytesFrImg, 0, bytesFrImg.Length);
System.Drawing.Image image = System.Drawing.Image.FromS
image.Save("L:\\FINSYS\\FS
MyGlobals.ctnumImg + "F.ard.out"); //, System.Drawing.Imaging.Ima
MemoryStream ms1 = new MemoryStream(bytesBkImg, 0, bytesBkImg.Length);
ms1.Write(bytesBkImg, 0, bytesBkImg.Length);
System.Drawing.Image image1 = System.Drawing.Image.FromS
image1.Save("L:\\FINSYS\\F
CheckImage.txt
sample.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.