System.Drawing.Image imgPhoto = System.Drawing.Image.FromFile(Server.MapPath(yourFile));
int sourceWidth = imgPhoto.Width;
int sourceHeight = imgPhoto.Height;
博客展示了使用C#代码读取图片尺寸的方法。通过System.Drawing.Image类的FromFile方法读取图片,然后获取图片的宽度和高度。
System.Drawing.Image imgPhoto = System.Drawing.Image.FromFile(Server.MapPath(yourFile));
int sourceWidth = imgPhoto.Width;
int sourceHeight = imgPhoto.Height;

被折叠的 条评论
为什么被折叠?