I have an Image object that I'm trying to resize from a picture box via Bitmap.
I have a source to the picture box on my desktop and the code is as follows
Bitmap image = new Bitmap(pictureBox1.Image);
Size newSize = new Size(100,100);
image = new Bitmap( (Image)image, newSize);
// here I get Parameter not valid, Argument Exception was unhandled
pictureBox1.Image = (Image)image;
Why is that exception being thrown?
First of all, I don't understand why you create 2 bitmap objects? Why do not something like this:
However I don't think that exception is caused by shown code. It's possible to read above on screen :
Have you calculated how big is that picture?
Size x 4 bytes of format = 3.0464^ 10.
I don't think that you have enough memory to allocate this image.