title: How to read bytes from a image url (jpeg) and encode in base64 on Python 2.7?
body: <p>I am using the following code:</p>
  
  <pre><code>import urllib, cStringIO
  from PIL import Image  
  url='https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png'
  file = cStringIO.StringIO(urllib.urlopen(url).read())
  img = Image.open(file)
  </code></pre>
  
  <p>based on: <a href="https://stackoverflow.com/questions/7391945/how-do-i-read-image-data-from-a-url-in-python">How do I read image data from a URL in Python?</a></p>
  
  <p>Now I need to base64 encode it for posting to Google Cloud Vision API. How to do that?</p>
  
  <p>Or does the Google Cloud vision API work with image urls?</p>