如果你想要在后台获取图片大小,可以
System.Drawing.Image img = System.Drawing.Image.FromFile( Server.MapPath("image/2.gif"));
//如果是上传的文件,可以用System.Drawing.Image img = System.Drawing.Image.FromStream(this.File1.PostedFile.InputStream);
int height = img.Height;
int width = img.Width;
/*设置图片的宽和高*/
img.Height = bmp.Height;
img.Width = bmp.Width;
时间: 2024-10-03 13:28:03