PIL.UnidentifiedImageError: cannot identify image file
import base64
import io
from io import BytesIO
from PIL import Image
byteImgIO = io.BytesIO()
byteImg = Image.open('./images/img_small.png')
byteImg.save(byteImgIO, "PNG")
byteImgIO.seek(0)
byteImg = byteImgIO.read()
v2 = base64.b64encode(byteImg)
v3 = base64.b64decode(v2)
# i = Image.open(BytesIO(v3))
# i = i.convert('L')
i = BytesIO(v3)
i.seek(0)
i = Image.open(i)
i.save('./images/a.png')
print('finish')
댓글 없음:
댓글 쓰기