with open("sample.jpg", 'rb') as image_file: image_64_encode = base64.b64encode(image_file.read()).decode("utf-8")