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 200 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 (bundled in the recoil-3.2.0 directory) 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.

Author

Matt Westcott - matt@west.co.tt, http://twitter.com/gasmanic

Project details


Download files

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

Source Distribution

pyrecoil-0.2.tar.gz (72.7 kB view details)

Uploaded Source

Built Distribution

pyrecoil-0.2-cp27-cp27m-macosx_10_6_intel.whl (208.1 kB view details)

Uploaded CPython 2.7m macOS 10.6+ intel

File details

Details for the file pyrecoil-0.2.tar.gz.

File metadata

  • Download URL: pyrecoil-0.2.tar.gz
  • Upload date:
  • Size: 72.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyrecoil-0.2.tar.gz
Algorithm Hash digest
SHA256 48e682a50226340d2acddabd89218b9ee142716410d8ab19e211d33448c04b7e
MD5 182ff8834023385b6cefc6dcca098ec0
BLAKE2b-256 600a92be319ccc0e5ff7080fd847cfe170eeda827d36fb2ddffecba31d77a5fc

See more details on using hashes here.

File details

Details for the file pyrecoil-0.2-cp27-cp27m-macosx_10_6_intel.whl.

File metadata

File hashes

Hashes for pyrecoil-0.2-cp27-cp27m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 66596e9cbaf2b9ac90109adbaccb21a4fde09c92a7578ab76b65d79dbc89a809
MD5 ce684f1d85b446ec731ab10b3793651b
BLAKE2b-256 57e12e3b9c855d3afdea4cc560c0b6b29474633096d449a31f91ef59c184bc9b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page