话不多说,代码如下:
from io import BytesIO
from PIL import Image
bytesIO = BytesIO()
image_path = "" #路径
file_content = Image.open(image_path)
file_content.save(bytesIO, format='PNG')
print(bytesIO.getvalue())
话不多说,代码如下:
from io import BytesIO
from PIL import Image
bytesIO = BytesIO()
image_path = "" #路径
file_content = Image.open(image_path)
file_content.save(bytesIO, format='PNG')
print(bytesIO.getvalue())