Finding Image Size in C#.NET RRS feed

  • Question

  • User-63478364 posted

     Hi all,

    i want to find the Image Height and Width in cm/inch/mm format.

    i used the following code:

    Image img = Image.FromFile("image path");

    double iHeight = img.Height;

    double iWidth = img.Width;

     but, it display Height and Width in Pixels format.

    In forum, they instructed as following:

    for converting pixel to inch then, we have to do

    (img.Height / img.VerticalResolution) * 25.4 = height in mm

    (img.Width / img.HorizontalResolution)  * 25.4 = width in mm

    But, now the problem is,

    if i use .net application - then, it showing 96 dpi of HorizontalResolution.if i open same image in illustrator - it showing 72 dpi of HorizontalResolution.

    Now, what i have to do?

    why there is a difference in Resolution for the same image in two different software?

    how to calculate image Height in inch.

    pls, help me







    Wednesday, March 4, 2009 10:57 PM