from PIL import Image
import io

output_buff = io.BytesIO()
new_image = Image.new("RGB", (300, 50))
new_image.save(output_buff, format="PNG")
byte_content: bytes = output_buff.getvalue()

string_content = byte_content.decode("ISO-8859-1") # 想作为string存到hive table里,但是会有串行串列的问题
byte_content = string_content.encode("ISO-8859-1")

f = io.BytesIO(byte_content)
reload_img = Image.open(f)
print(reload_img.size)