i want image dimension bmp,jpg,png and tiff
Thanks.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Amit GuptaRank #190 · 12.8K reputationPosted May 23, 2017, 12:03 PM EDT
Mohamed AbedallahRank #2,074 · 697 reputationPosted May 24, 2017, 4:45 AM EDT
/**********************/
System.Drawing.Image _img = System.Drawing.Image.FromFile(@"C:\temp\Image1.TIF");
MessageBox.Show("Image Width:" + _img.Width.ToString() + Environment.NewLine + "Image Height:" + _img.Height.ToString());
/**********************/
Note that not all file formats are natively supported under .NET, so you may consider using a professional toolkit like LEADTOOLS, which is also easy to use. The following simple code shows how you can get the dimensions of an image:
/*************************/
RasterCodecs _codecs = new RasterCodecs();
CodecsImageInfo information = _codecs.GetInformation(@"C:\temp\Image1.TIF", true);
MessageBox.Show("Image Width:" + information.Width.ToString() + Environment.NewLine + "Image Height:" + information.Height.ToString());
/*************************/