Reputation: 47
I get unhandled exception when I run this code:
using (Graphics g = Graphics.FromImage(target))
{
g.DrawImage(imageInput, new Rectangle(0, 0, target.Width, target.Height),
rect, GraphicsUnit.Pixel);
}
It says :
System.ArgumentNullException : 'The value can not be null. Parameter name: image
Any suggestion?
Upvotes: 0
Views: 141
Reputation: 14655
This is because imageInput
is null
. Parameter name: image
is the important part. If you take a look at the documentation for DrawImage, you'll see it takes an image
parameter. This is the first argument passed to DrawImage
, which corresponds with imageInput
.
Therefore, you need to initialise imageInput
.
Upvotes: 1