I can display the image in the image window without checking the file size using the following code:
private void button3_Click_1(object sender, EventArgs e) { try { //Getting The Image From The System OpenFileDialog open = new OpenFileDialog(); open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp"; if (open.ShowDialog() == DialogResult.OK) { Bitmap img = new Bitmap(open.FileName); pictureBox2.Image = img; } } catch (Exception) { throw new ApplicationException("Failed loading image"); } }
I want to check the image size, for example, 2 MB or 4 MB , before displaying it in the image window. I also want to check the width height and height .
c # image width height
bharathi
source share