Following code is used to get the height and width of image
//In case of images stored in sever.
System.Drawing.
Image objImage = System.Drawing.Image.FromFile(@"D:\a.jpg");
int width = objImage.Width;
int height = objImage.Height;
//In case of validating image before uploadbyte[] imgdata = System.IO.File.ReadAllBytes(@"D:\a.jpg");
System.IO.
MemoryStream memoryStream = new System.IO.MemoryStream(imgdata);
System.Drawing.
Image objStreemImage = System.Drawing.Image.FromStream(memoryStream);
int widthMemoryStream = objStreemImage.Width;
int heightMemoryStream = objStreemImage.Height;
Thanks
Mahesh
//In case of images stored in sever.
System.Drawing.
Image objImage = System.Drawing.Image.FromFile(@"D:\a.jpg");
int width = objImage.Width;
int height = objImage.Height;
//In case of validating image before uploadbyte[] imgdata = System.IO.File.ReadAllBytes(@"D:\a.jpg");
System.IO.
MemoryStream memoryStream = new System.IO.MemoryStream(imgdata);
System.Drawing.
Image objStreemImage = System.Drawing.Image.FromStream(memoryStream);
int widthMemoryStream = objStreemImage.Width;
int heightMemoryStream = objStreemImage.Height;
Thanks
Mahesh
No comments:
Post a Comment