4
How to get the width
and height
of a physical image file?
4
How to get the width
and height
of a physical image file?
5
You can get this information using the class Image
, through the properties Height
and Width
.
var img = System.Drawing.Image.FromFile(@"c:\Path\1.jpg");
MessageBox.Show("Width: " + img.Width + ", Height: " + img.Height);
4
Can for some supported formats:
var imagem = Image.FromFile("teste.jpg");
var largura = imagem.Width;
var altura = imagem.Height;
In accordance with the documentation it is possible to open BMP, GIF, JPEG, PNG and TIFF.
Browser other questions tagged c# .net winforms image drawing
You are not signed in. Login or sign up in order to post.
What format is the file? What image technology is using?
– Maniero
@bigown jpeg and png. If it can be something more generic that addresses several formats it would help me even more. However jpeg and png are already enough.
– Arthur Menezes