Is there a way I can get Panda to tell me the width and height of an image file (.png) that I am loading as a texture? I know I can do it with PIL easily enough but would rather not have to add another dependency if I can avoid it.
Sure you can. If you’ve loaded it via loader.loadTexture you can query the size like this:
yourTex = loader.loadTexture("yadda yadda")
print yourTex.getXSize(), yourTex.getYSize()
More methods like getXSize etc. are shown on the API reference page of Texture.
Alternatively, if you don’t want to read the texture itself but just the header to find out the size, you can do so using PNMImageHeader:
header = PNMImageHeader()
header.readHeader(Filename("yadda yadda"))
print header.getXSize(), header.getYSize()
If you’re gonna load the texture anyways I recommend the first way though.
Oh, and if you want to open the texture for editing, and not to use it in the scene graph, you can find out using the PNMImage class as well.