I wrote a little wrapper using the API that does this. You can see the code on my
wiki.
Last I checked I couldn't find any direct command calls that do this, but maybe PyMel has some undiscovered magic.
Optionally if you have the texture assigned to a file node:
string $xSize = `getAttr "file1.outSizeX"`;