Skip to content

Instantly share code, notes, and snippets.

@peune
Created May 30, 2019 08:48
Show Gist options
  • Save peune/ad9b7aa6668527867aa36412fb576543 to your computer and use it in GitHub Desktop.
Save peune/ad9b7aa6668527867aa36412fb576543 to your computer and use it in GitHub Desktop.
import base64
def _image_url(img):
retval, buffer = cv2.imencode('.jpg', img)
base64_byte_string = base64.b64encode(buffer).decode('utf-8')
return "data:image/JPEG;base64," + base64_byte_string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment