PIL/Python 3移植印象

2024-04-29 16:03:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试移植Impressive,以便与python3一起使用。在

在某个点那里的标志必须加载。徽标是硬编码的。 所以看起来像这样:

LOGO = '\x89PNG\r\n\x1a\n\x00\x0 ...'
LogoImage = Image.open(StringIO.StringIO(LOGO))

当尝试将其移植到python3中使用时,请将该行更改为:

^{pr2}$

我收到以下错误消息

OSError: cannot identify image file <_io.StringIO object at 0x106b388b8>

我读了一些关于StringIO和BytesIO的文章。但还没找到解决办法。在

编辑:

从光盘加载图像不是问题。在


Tags: image编码标志openpython3logo徽标x00