code: def image_size(self, pnmfile):
          
          pout = os.popen(self.shellsetup + self.pnmfile + ' ' + pnmfile, 'r')
          pnmfileout = pout.read(200)
          pout.close()
          m = re.search(', (\d+) by (\d+) ', pnmfileout)
          if (m is None):
              raise IIIFError(
                  text="Bad output from pnmfile when trying to get size.")
          w = int(m.group(1))
          h = int(m.group(2))
          # print "pnmfile output = %s" % (pnmfileout)
          # print "image size = %d,%d" % (w,h)
          return(w, h)
docs: Get width and height of pnm file.
  
          simeon@homebox src>pnmfile /tmp/214-2.png
          /tmp/214-2.png:PPM raw, 100 by 100  maxval 255