Skip to main content

Python bindings for RECOIL, the Retro Computer Image Library

Project description

pyrecoil provides Python bindings to RECOIL, the Retro Computer Image Library, allowing you to open over 400 image file formats from retro computers.

Installation

pip install pyrecoil

pyrecoil is most useful when installed in conjunction with Pillow, the active fork of the Python Image Library:

pip install Pillow

Usage

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')

Build notes

The RECOIL library itself is implemented in the Ć Programming Language. For ease of distribution, the generated C output (recoil.c and recoil.h) from the cito transpiler is included in the package - this, along with recoil_interface.c, forms the Python extension module.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyrecoil, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size pyrecoil-0.3-cp27-cp27m-macosx_10_6_intel.whl (444.3 kB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size pyrecoil-0.3-cp36-cp36m-macosx_10_9_x86_64.whl (229.4 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pyrecoil-0.3-cp37-cp37m-macosx_10_9_x86_64.whl (229.4 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pyrecoil-0.3-cp38-cp38-macosx_10_9_x86_64.whl (229.4 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pyrecoil-0.3.tar.gz (110.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page