title: JPG image size reduced on imsave
body: <p>I am building up a library called <a href="http://hips.readthedocs.io/" rel="nofollow noreferrer">hips</a> where one module is involved with fetching tile images and storing them on disk. The problem here is that I fetch a tile from a <a href="http://alasky.unistra.fr/2MASS/H/Norder6/Dir30000/Npix30889.jpg" rel="nofollow noreferrer">remote URL</a> and save it using <a href="https://docs.scipy.org/doc/scipy-0.19.0/reference/generated/scipy.misc.imsave.html" rel="nofollow noreferrer">scipy.misc.imsave</a> function in a temporary directory. The saved file size is <code>41.0 kB</code>, however, if I save the file manually from the <a href="http://alasky.unistra.fr/2MASS/H/Norder6/Dir30000/Npix30889.jpg" rel="nofollow noreferrer">remote URL</a>, its size is <code>119.7 kB</code>.</p>
  
  <p>I have copied the failed test case below:</p>
  
  <pre><code>def test_fetch_read_write_jpg(self, tmpdir):
      meta = HipsTileMeta( ... )
      url = 'http://alasky.unistra.fr/2MASS/H/Norder6/Dir30000/Npix30889.jpg'
      tile = HipsTile.fetch(meta, url)
  
      filename = str(tmpdir / 'Npix30889.jpg')
      tile.write(filename)
      tile2 = HipsTile.read(meta, filename=filename)
      print(tile.data.shape)
      print(tile2.data.shape)
  
      assert tile == tile2 
  </code></pre>
  
  <p>Here is the failed assertion:</p>
  
  <blockquote>
    <p>----------------------------------Captured stdout call-------------------------------------- </p>
    
    <p>(512, 512, 3)</p>
    
    <p>(512, 512, 3)</p>
    
    <p>False</p>
  </blockquote>
  
  <p>The code involved with tile storing is shown below:</p>
  
  <pre><code>from scipy.misc import imsave
  def write(self, filename: str = None) -&gt; None:
      path = Path(filename) if filename else self.meta.full_path
      imsave(str(path), self.data)
  </code></pre>
  
  <p>I also tried saving the file using <a href="http://pillow.readthedocs.io/en/3.4.x/reference/Image.html" rel="nofollow noreferrer">PIL.Image</a> library, using this code:</p>
  
  <pre><code>from PIL import Image
  image = Image.fromarray(self.data)
  image.save(str(path))
  </code></pre>
  
  <p>But, it produces the same results. I tried printing out the tile data at index <code>[0][0]</code> which came to be <code>[10, 10, 10]</code> for both cases. Also, I displayed the image using <code>matplotlib</code>, and the results were identical. But, I can't figure out the reason for the reduction in size / quality.</p>