【发布时间】:2012-01-12 19:26:11
【问题描述】:
我有一张 png 图片,我需要将它保存为字符串,然后用 PIL 再次打开它。我正在尝试这样做:
output = StringIO.StringIO()
old_image.save(output, format="PNG")
contents = output.getvalue()
output.close()
new_image = Image.fromstring(contents, "RGBA", old_image.size)
但它给了我一个错误:TypeError: 'argument 1 must be string without null bytes, not str'
如何解决这个问题?
【问题讨论】:
标签: python python-imaging-library