Im trying to take an input from a webcam and only want the centre of the image (to passport size image).
I have a Picturebox with the webcam stream which I have set SizeMode to CentreImage. I then have a second picturebox which when I click the second picturebox i then need a cropped image i then save later (currently i get the whole original image when saving).
I have code to crop this image into the 2nd picturebox which works however it loses loads of quality. Is there a way to make this crop lossless?
private void pictureBox1_Click(object sender, EventArgs e)
{
//picPhoto.Image = pic.Image;
using (Bitmap bmp = new Bitmap(pic.Image))
{
var newImg = bmp.Clone(
new Rectangle { X = ((pic.Image.Width/2)-(350/2)), Y = ((pic.Image.Height / 2) - (450 / 2)), Width = 350, Height = 450 },
bmp.PixelFormat);
picPhoto.Image = newImg;
}
}