用于反冲的python绑定,复古计算机图像库

pyrecoil的Python项目详细描述


pyrecoil提供python绑定到RECOIL(复古计算机图像库),允许您从复古计算机打开200多个图像文件格式。

安装

pip install pyrecoil

pyrecoilPillow(python映像库的活动分叉)一起安装时最有用:

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-3.2.0目录中)在Ć Programming Language中实现。为了便于分发,从citotranspiler生成的c输出(recoil.crecoil.h)包含在包中,这与recoil_interface.c一起构成python扩展模块。

作者

马特·韦斯科特-matt@west.co.tthttp://twitter.com/gasmanic

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java类。getConstructor找不到兼容的构造函数   java单元测试自定义输入和输出格式   javascript Java UI线程内存不足错误被阻止   多线程在Java并发API中从线程池中选择线程的逻辑是什么?   java在MySQL数据库上存储歌曲(BLOb支持)   java快速且可扩展的IO传递   jsf c:forEach-inside-primeface(例如p:panelgrid)inside-ui:repeat   tomcat与JavaServlet3.0文件上传,如何获取maxfilesize值   java JNI,加载2次相同的dll(不同的名称),如何选择使用哪一个?   java将InputStream复制到OutputStream将停止,除非我也向系统写入。出来   java Set反向安全约束   比如在java中使用整数时?   java使用@接口抑制IntelliJ中的某些警告   java我的ASCII艺术在JLabel上是错误的   JavaSpring工具源代码(或带有SpringIde的Eclipse)崩溃   向片段添加ListView时出现java错误   循环Java循环错误需要重新审视   JavaAspectJ:匹配GenericServlet。带注释子类实例的init()调用