zimmer9
asked on
I am developing a C# application and I pass along 2 check images to a function. Can you tell by the file I attached that contains snapshots what the error is?
I am developing a C# application and I pass along 2 check images to the function that follows.
The 1st check image is the Front of a Check
The 2nd check image is the Back of a Check
In the attached file you can see snapshots of the error I received:
Do you see any information in the attachments that would indicate why the error occurred?
ArgumentException was unhandled of type 'System.ArgumentException' occurred in System.Drawing.dll
Additional information: Parameter is not valid.
public static Bitmap MergeTwoImages(Image firstImage, Image secondImage)
{
if (firstImage == null)
{
throw new ArgumentNullException("fir stImage");
}
if (secondImage == null)
{
throw new ArgumentNullException("sec ondImage") ;
}
int outputImageWidth = firstImage.Width > secondImage.Width ? firstImage.Width : secondImage.Width;
int outputImageHeight = firstImage.Height + secondImage.Height + 1;
Bitmap outputImage = new Bitmap(outputImageWidth, outputImageHeight, System.Drawing.Imaging.Pix elFormat.F ormat32bpp Argb);
using (Graphics graphics = Graphics.FromImage(outputI mage))
{
graphics.DrawImage(firstIm age, new Rectangle(new Point(), firstImage.Size),
new Rectangle(new Point(), firstImage.Size), GraphicsUnit.Pixel);
graphics.DrawImage(secondI mage, new Rectangle(new Point(0, firstImage.Height + 1), secondImage.Size),
new Rectangle(new Point(), secondImage.Size), GraphicsUnit.Pixel);
}
return outputImage;
}
Image-files.msg
The 1st check image is the Front of a Check
The 2nd check image is the Back of a Check
In the attached file you can see snapshots of the error I received:
Do you see any information in the attachments that would indicate why the error occurred?
ArgumentException was unhandled of type 'System.ArgumentException'
Additional information: Parameter is not valid.
public static Bitmap MergeTwoImages(Image firstImage, Image secondImage)
{
if (firstImage == null)
{
throw new ArgumentNullException("fir
}
if (secondImage == null)
{
throw new ArgumentNullException("sec
}
int outputImageWidth = firstImage.Width > secondImage.Width ? firstImage.Width : secondImage.Width;
int outputImageHeight = firstImage.Height + secondImage.Height + 1;
Bitmap outputImage = new Bitmap(outputImageWidth, outputImageHeight, System.Drawing.Imaging.Pix
using (Graphics graphics = Graphics.FromImage(outputI
{
graphics.DrawImage(firstIm
new Rectangle(new Point(), firstImage.Size), GraphicsUnit.Pixel);
graphics.DrawImage(secondI
new Rectangle(new Point(), secondImage.Size), GraphicsUnit.Pixel);
}
return outputImage;
}
Image-files.msg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ee-fixed.docx
.msg files are openable via outlook and they will probably be ignored since opening untrusted files are an attack vector