Skip to content

Instantly share code, notes, and snippets.

@luisgdev
Created September 1, 2022 22:44
Show Gist options
  • Select an option

  • Save luisgdev/c27e9808cf20aef718bc24fbbb46791b to your computer and use it in GitHub Desktop.

Select an option

Save luisgdev/c27e9808cf20aef718bc24fbbb46791b to your computer and use it in GitHub Desktop.
Convert image to base64
import base64
image_path = 'IMG_01.jpg'
with open(image_path, 'rb') as image:
result = base64.b64encode(image.read()).decode('utf-8')
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment