Q:

how to calculate height and width of image

I have server side image control as: 
  <img id="img" runat="server" style="padding-left:20px" 
       src="~/Images/2013-02-14_225913.png" />

I want to calculate its height and width. I did it as:
int iWidth = (int)Math.Round((decimal)img.Width.Value);
int iHeight = (int)Math.Round((decimal)img.Height.Value);

This returns -0, not actual parameters.
How can I get the H & W of the image control?

A:

Bitmap btmp;
string image = "~/Images/2013-02-14_225913.png";
myBitmap = new Bitmap(image);

int height= btmp.Height;
int weight = btmp.Width;

