Reputation:
I'm reading in an image (jpg) using the code below and I need to check that the image is no bigger than 150 pixels by 150 pixels and is less than 25k, how should I do this?
PictureBox2.Image = Image.FromFile(.FileName)
Upvotes: 1
Views: 12463
Reputation: 422182
If New FileInfo(.FileName).Length > 25 * 1024 Then ... 'More than 25KB'
Dim img = Image.FromFile(.FileName)
If img.Size.Width > 150 OrElse img.Size.Height > 150 Then ... 'More than 150x150'
Picturebox1.Image = img
Upvotes: 7