我正在使用下面的代码读取图像(jpg),我需要检查图像是否大于150像素×150像素且小于25k,我应该怎么做?
PictureBox2.Image = Image.FromFile(.FileName)
答案 0 :(得分:7)
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