title: Downloading image with PIL and requests
body: <p>I am trying to download an original image (png format) by url, convert it on the fly (without saving to disc) and save as jpg. </p>
  
  <p>The code is following:</p>
  
  <pre><code>import os
  import io
  import requests
  from PIL import Image
  ...
  r = requests.get(img_url, stream=True)
  if r.status_code == 200:
      i = Image.open(io.BytesIO(r.content))
      i.save(os.path.join(out_dir, 'image.jpg'), quality=85)
  </code></pre>
  
  <p>It works, but when I try to monitor the download progress (for the future progress bar) with r.iter_content() like this:</p>
  
  <pre><code>r = requests.get(img_url, stream=True)
  if r.status_code == 200:
      for chunk in r.iter_content():
          print(len(chunk))
      i = Image.open(io.BytesIO(r.content))
      i.save(os.path.join(out_dir, 'image.jpg'), quality=85)
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "E:/GitHub/geoportal/quicklookScrape/temp.py", line 37, in &lt;module&gt;
      i = Image.open(io.BytesIO(r.content))
    File "C:\Python35\lib\site-packages\requests\models.py", line 736, in content
      'The content for this response was already consumed')
  RuntimeError: The content for this response was already consumed
  </code></pre>
  
  <p>So is it possible to monitor the download progress and after get the data itself?</p>