跳转到主要内容

RECOIL库的Python绑定,Retro Computer Image Library

项目描述

pyrecoilRECOIL(Retro Computer Image Library)提供Python绑定,允许您打开来自复古计算机的500多种图像文件格式。

安装

pip install pyrecoil

pyrecoilPillow(Python Image Library的活跃分支)一起安装时最为有用。

pip install Pillow

使用方法

from recoil import RecoilImage

# load image from disk and decode it:
img = RecoilImage("foo.lbm")

# load image from an existing file handle:
# (filename must still be provided, as a hint to the decoder)
img = RecoilImage("foo.lbm", f)

# inspecting properties:
img.colors  # number of colors used in the image
> 16

img.frames  # number of alternating frames (used for 'interlace' / 'gigascreen' effects)
> 1

img.size  # return a tuple of (width, height)
> (320, 200)

img.original_size  # for images that have been resized to account for non-square pixels
> (320, 200)

img.platform
> 'Amiga'

# Retrieving pixel data -
# returns a bytearray consisting of three bytes (r, g, b) for each pixel,
# in left-to-right, top-to-bottom order
pixels = img.get_pixels()

# convert to a PIL / Pillow image object:
pil_image = img.to_pil()
pil_image.save('foo.png')

构建说明

RECOIL库本身是用 Fusion编程语言 实现的。为了便于分发,包含在包中的C输出(recoil.crecoil.h)来自 fut 编译器,以及 recoil_interface.c,共同构成了Python扩展模块。

作者

Matt Westcott - matt@west.co.tthttp://twitter.com/gasmanic

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源代码分布

pyrecoil-0.3.10.tar.gz (141.0 kB 查看哈希值)

上传时间 源代码

构建分布

pyrecoil-0.3.10-cp312-cp312-macosx_10_9_universal2.whl (568.4 kB 查看哈希值)

上传时间 CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64)

pyrecoil-0.3.10-cp311-cp311-macosx_10_9_universal2.whl (568.4 kB 查看哈希值)

上传时间 CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

pyrecoil-0.3.10-cp310-cp310-macosx_10_9_universal2.whl (568.4 kB 查看哈希值)

上传时间 CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

pyrecoil-0.3.10-cp39-cp39-macosx_10_9_x86_64.whl (299.9 kB 查看哈希值)

上传时间 CPython 3.9 macOS 10.9+ x86-64

pyrecoil-0.3.10-cp38-cp38-macosx_10_9_x86_64.whl (299.9 kB 查看哈希值)

上传时间 CPython 3.8 macOS 10.9+ x86-64

pyrecoil-0.3.10-cp37-cp37m-macosx_10_9_x86_64.whl (299.9 kB 查看哈希值)

上传时间 CPython 3.7m macOS 10.9+ x86-64

由以下支持