Skip to main content

Load AMOS banks in Python

Project description

amos-abk

A Python library for loading AMOS .abk bank files from the Amiga.

Parses the container format and three image bank types:

  • Sprites — hardware sprite images with hotspot and transparency
  • Icons — software bob images (same format as sprites)
  • Pac.Pic. — packed full-screen pictures with three-stream RLE compression

Non-image banks (Music, Samples, Amal, Datas) are loaded as raw DataBank objects.

Links

Install

pip install amos-abk

Library usage

from amos_abk import load, parse_sprites, parse_packed_picture

# Load a bank file
abk = load("sprites.abk")
print(abk)  # AbkFile([Sprites])

# Parse sprites and convert to PIL Images
sprites = parse_sprites(abk.banks[0].data)
for i, sprite in enumerate(sprites):
    sprite.to_image().save(f"sprite_{i}.png")

# Parse a packed picture
abk = load("picture.abk")
pic = parse_packed_picture(abk.banks[0].data)
pic.to_image().save("picture.png")

# Access raw data
print(pic.width, pic.height, pic.num_planes)
print(pic.palette[:4])  # first 4 RGB tuples

Pillow plugin

import amos_abk registers a Pillow plugin, so you can open .abk files directly:

from PIL import Image
import amos_abk

img = Image.open("sprites.abk")
img.save("first_sprite.png")

# Multi-frame: seek through all images in the file
for i in range(img.n_frames):
    img.seek(i)
    img.save(f"frame_{i}.png")

# The parsed AbkFile is available in metadata
abk = img.info["abk"]
print(abk.banks[0].name)

Extract all images

The images() function extracts every image from every bank in a file:

import amos_abk

# From a file path
imgs = amos_abk.images("sprites.abk")
for i, img in enumerate(imgs):
    img.save(f"image_{i}.png")

# Or from an already-loaded AbkFile
abk = amos_abk.load("sprites.abk")
imgs = amos_abk.images(abk)

Format overview

AMOS was a game-creation environment for the Amiga, released in 1990. It stored graphics and other resources in .abk memory bank files.

Bank container

Each .abk file contains one or more banks, either bare (AmSp/AmIc magic) or wrapped in an AmBk header with a bank number, name, and memory type.

Sprite and icon banks

Sprites and icons share the same format: a count, per-image headers (dimensions, bitplane count, hotspot), interleaved planar bitmap data, and a shared 32-entry 12-bit Amiga palette.

Pac.Pic. banks

Packed pictures are compressed full-screen Amiga images. They have two layers:

  1. Screen header (magic 0x12031990) — dimensions, display window, flags, and palette
  2. Packed bitmap (magic 0x06071963) — three-stream RLE compression where POINTS controls RLEDATA, and RLEDATA controls PICDATA

License

WTFPL: do as you like, but don't blame me if it banks your sprites.

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

amos_abk-0.1.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

amos_abk-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file amos_abk-0.1.0.tar.gz.

File metadata

  • Download URL: amos_abk-0.1.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for amos_abk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 40b25beb9d57aa50edda1d3d262318eb0cf51053a82a2bb9b005371e5261e29f
MD5 3c7b18317caafc209fda0230a6f18534
BLAKE2b-256 866ff45b13895e5814bf70b8b4ec31e56b0452cee57b1aa70c051cb6fb79defe

See more details on using hashes here.

File details

Details for the file amos_abk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: amos_abk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for amos_abk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be993ec81e2d14b3f67da30ccdbf44ac82011201ab6c524e40ff73f20ed82731
MD5 a39b74ae9452fceb321eec85151c2610
BLAKE2b-256 34d9fde851d605ed27c350125244d1dece75e8cb7cfbcebf32f4af709c5d9d2b

See more details on using hashes here.

Supported by

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