Bitmap.HorizontalResolution and Bitmap.VerticalResolution properties RRS feed

  • Question

  • I have one question about how windows read some properties of an Image. When i rightclick on an Image and in Properties window if i goto Details tab then it shows that Image has 200 dpi as Horizontal and Vertical Resolution.

    But if i use VB.Net code

    objBitmap=New Bitmap(Image.FromFile("C:\Image1.jpg"))



    then value of intXResolution and intYResolution is 96

    How i can get correct Image resolution values in VB.Net?

    Friday, December 20, 2013 8:14 PM


  • Hi,

    I created a sample on my end to read an image’s resolution. Something look like,

    The image file’s details:

    VB.NET Code:

        Sub Main()
            Dim simleImage As System.Drawing.Image = System.Drawing.Image.FromFile("Resources\Smile.png")
            Console.WriteLine(simleImage.Height.ToString() + "*" + simleImage.Width.ToString())
        End Sub

    The result is shown in the following figure,

    About Image.HorizontalResolution Property, we used this property to get the in pixels per inch in usual.

    Have a nice time!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 23, 2013 6:02 AM