【问题标题】:Create a bitmap file in python 3.4 [closed]在 python 3.4 中创建位图文件 [关闭]
【发布时间】:2015-01-15 16:20:13
【问题描述】:

我需要使用 python 3.4 创建一个白色位图文件。我已经在互联网上搜索过,但模块“Image”或“ImageDraw”在 Python 3.4 中不起作用。那么如何创建位图文件呢?或者也许我必须使用哪些模块?

【问题讨论】:

标签: python-3.x bitmap bmp


【解决方案1】:

获取枕头,在 2.6 到 3.4 运行。

pip install pillow

应该在命令行下工作(如果在 python34/Scripts 中也可以)。因为它是 PIL 的兼容分支,所以导入为PIL。我还没有使用它,但是从文档中,

from PIL import Image
im = Image.new(<specs>)  # size, pixel deptch
im.save('x.bmp', ...)

应该做你想做的。

【讨论】:

    猜你喜欢
    • 2014-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-28
    • 2016-05-22
    • 1970-01-01
    • 2021-12-05
    • 2014-03-19
    相关资源
    最近更新 更多