JavaExperts see http://www.w3schools.com/jsref/dom_obj_image.asp
naturalWidth and naturalHeight
but its a bit patchy on mobile browsers
in php its easy
http://php.net/manual/en/function.getimagesize.php
I will ask about a new xt:function to return image data
but that may take a while and even then no promises