I can get the right X,Y,W,H value if I don't change the picture. If I change to another picture, the W, H value will be the same value of the first picture.
You can see my code here:
http://jsfiddle.net/dA25D/
If you click the set src to null button and then click the set src to another picture, you will see that the X,Y,W,H value is different from the right one.