title: How do I use reportlab's drawImage with an image url?
body: <p>When I try the following:</p>
  
  <pre><code>from reportlab.lib.pagesizes import letter
  from reportlab.pdfgen.canvas import Canvas
  import urllib
  import StringIO
  import PIL.Image
  
  image_file = urllib.urlopen('https://www.google.com/images/srpr/logo11w.png')
  image_string = StringIO.StringIO(image_file.read())
  logo = PIL.Image.open(image_string)
  
  canvas = Canvas('output.pdf', pagesize=letter)
  canvas.drawImage(logo, 10, 10)
  canvas.showPage()
  canvas.save()
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "imagefromurl.py", line 12, in &lt;module&gt;
      canvas.drawImage(logo, 10, 10)
    File "/usr/lib/python2.7/dist-packages/reportlab/pdfgen/canvas.py", line 857, in drawImage
      imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask)
    File "/usr/lib/python2.7/dist-packages/reportlab/pdfbase/pdfdoc.py", line 2090, in __init__
      ext = string.lower(os.path.splitext(source)[1])
    File "/usr/lib/python2.7/posixpath.py", line 96, in splitext
      return genericpath._splitext(p, sep, altsep, extsep)
    File "/usr/lib/python2.7/genericpath.py", line 91, in _splitext
      sepIndex = p.rfind(sep)
    File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 515, in __getattr__
      raise AttributeError(name)
  </code></pre>
  
  <p>Reportlab is version 2.5.</p>