fix: KeyError['JPG']

This commit is contained in:
Shivam Mishra 2020-06-04 16:54:38 +05:30
parent 342a51920e
commit 56019241ac

View file

@ -771,6 +771,8 @@ def image_to_base64(image, extn):
from io import BytesIO
buffered = BytesIO()
if extn.lower() == 'jpg':
extn = 'JPEG'
image.save(buffered, extn)
img_str = base64.b64encode(buffered.getvalue())
return img_str