title: How to turn numpy array image to bytes?
body: <p>I need to recognize image with Google Vision API. Among the examples, they use following construction:</p>
  
  <pre><code>with io.open('test.png', 'rb') as image_file:
      content = image_file.read()
  image = vision.types.Image(content=content)
  </code></pre>
  
  <p>I need to do similar, but my image comes from:</p>
  
  <pre><code>content = cv2.imread()
  </code></pre>
  
  <p>Which returns numpy array, not bytes. I tried:</p>
  
  <pre><code>content = content.tobytes()
  </code></pre>
  
  <p>Which converts array to bytes, but returns different bytes apparently, since it gives different result.<br>
  So how to make my image array similar to one which I get by <code>open()</code> function</p>