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 usefull 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.1.1.tar.gz (393.2 kB view details)

Uploaded Source

Built Distribution

pyrecoil-0.1.1-cp27-none-macosx_10_6_intel.whl (166.5 kB view details)

Uploaded CPython 2.7 macOS 10.6+ intel

File details

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

File metadata

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

File hashes

Hashes for pyrecoil-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7210731826137ec07dd300ef0161385dd44eec91c1a7174047dab6a2a916f0a3
MD5 228d3b3d5b6171ae9b2f5da5b325345b
BLAKE2b-256 7f4f4160edf2e000a4a652e1ba9a41fe5cf1e5f4e6c4a9972537a5fc46656d93

See more details on using hashes here.

File details

Details for the file pyrecoil-0.1.1-cp27-none-macosx_10_6_intel.whl.

File metadata

File hashes

Hashes for pyrecoil-0.1.1-cp27-none-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 884f65f93ecd1128917b81634485a7acc72ade64869fbae87162b1290ce11412
MD5 56f43321e3b36f7b6a1f5e4a717c94dd
BLAKE2b-256 7264f78225db19a4d849ce32ceed13ca348627569b55a8a5528eec921e8453b8

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