title: Python - how to read an image from a URL?
body: <p>I am completely new to Python and I'm trying to figure out how to read an image from a URL.</p>
  
  <p>Here is my current code:</p>
  
  <pre><code>from PIL import Image
  import urllib.request, io
  
  URL = 'http://www.w3schools.com/css/trolltunga.jpg'
  
  with urllib.request.urlopen(URL) as url:
      s = url.read()
      Image.open(s)
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>C:\python&gt;python image.py
  Traceback (most recent call last):
    File "image.py", line 8, in &lt;module&gt;
      Image.open(s)
    File "C:\Anaconda3\lib\site-packages\PIL\Image.py", line 2272, in open
      fp = builtins.open(filename, "rb")
  ValueError: embedded null byte
  </code></pre>
  
  <p>I have no idea what any of this means. What am I doing wrong?</p>