title: Display TIFF Image On Juypyter Notebook using Python Without Saving / Downloading
body: <p>I am working with web services using requests to get an image based on parameters passed. The first response I get is a XML schema with file reference URL. </p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;Coverages schemaLocation="http://localhost/server/schemas/wcs/1.1.1/wcsCoverages.xsd"&gt;
  &lt;Coverage&gt;
      &lt;Title&gt;Filename&lt;/Title&gt;
      &lt;Abstract/&gt;
      &lt;Identifier&gt;Filename&lt;/Identifier&gt;
      &lt;Reference href="http://localhost/server/temp/filename.tif"/&gt;
  &lt;/Coverage&gt;
  &lt;/Coverages&gt;
  </code></pre>
  
  <p>Next using <code>xml.etree.ElementTree</code> I extracted the URL. Next what I need is to dsiplay that tiff image (or any other image) on the Jupyter Notebook without <strong>downloading</strong> (as one image can be more than 50 or 100 MB sometimes)</p>
  
  <p>Currently I am downloading and plotting the file after reading and converting file data into array ( as pyplot plot image array/matrix ).</p>
  
  <pre><code>import requests as req # request wcs urls
  import xml.etree.ElementTree as ET # used for xml parsing
  import matplotlib.pyplot as plt # display image
  import gdal
  
  # Download the File to local directory using Chunks 
      chunk_size=1024
      local_filename = url.split('/')[-1] # Filename from url
      r = req.get(url, stream=True)
      with open(local_filename, 'wb') as f:
          for chunk in r.iter_content(chunk_size): 
              if chunk:
                  f.write(chunk)
  
      # Read File Raster Data as Array using Gdal
      gtif = gdal.Open(local_filename)
      georaster = gtif.ReadAsArray()
  
      # Plot image using matplotlib
      plt.imshow(georaster)
      plt.title(local_filename)
      plt.show()
  </code></pre>
  
  <p>So is there any way to convert the raw response from requests API for file directly into image array (in chunks or whole) and display it on notebook (without downloading and taking space on local directory)</p>
  
  <p>The raw response from get request for tiff file is below</p>
  
  <pre><code>resp2 = req.get('tiffFielurl')
  rawdata = resp2.content
  rawdata[0:10]
  
  Output: b'MM\x00*\x00\x00\x00\x08\x00\x10'
  </code></pre>
  
  <p>I tried searching for this question but not found any good answer on it so if there is any related question or duplicate provide me the link.</p>