title: Can't seem to read a tar.gz file correctly into Python
body: <p>I've downloaded a tar.gz file from this site:</p>
  
  <p><a href="http://www.vision.caltech.edu/Image_Datasets/Caltech101/" rel="nofollow noreferrer">http://www.vision.caltech.edu/Image_Datasets/Caltech101/</a></p>
  
  <p>It's supposed to contain many images.
  Ideally, I would like to read all the images into a huge np.array in their
  original dimensions. </p>
  
  <p>Here is one of my attempts:</p>
  
  <pre><code>import tarfile
  import numpy as np 
  
  
  images = []
  
  with tarfile.open(file, "r:gz") as tar:
  
      for member in tar.getmembers()[:10]:
           if  member.isfile():
                file=tar.extractfile(member)
                image.append(file.read())
  </code></pre>
  
  <p>Now file.read() returns class 'bytes' ; not sure how to read that into an
  numpy array.</p>
  
  <p>I've tried </p>
  
  <pre><code>np.array(file.read())  # ValueError: embedded null byte
  np.fromfile(file)   # AttributeError: '_FileInFile' object has no attribute 'fileno'
  </code></pre>