Skip to main content

Convert ZX-Paintbrush (.zxp) files to Boriel Basic

Project description

zxp2boriel

A Python tool to convert ZX-Paintbrush (.zxp) sprite files into Boriel Basic DIM array declarations.

Features

  • Converts ZX-Paintbrush bitmap data to Boriel Basic arrays
  • Exports tile attributes (colors) automatically
  • Generates individual arrays for each sprite/tile
  • Supports sprites of any size (must be multiple of 8)
  • Optional attribute export control

Installation

pip install zxp2boriel

Usage

zxp2boriel --input <file.zxp> --width <pixels> --rows <rows> --cols <cols> --output <file.bas> --name <array_name> [--no-attributes]

Arguments

  • --input, -i: Input .zxp file path.
  • --width, -w: Tile width in pixels (must be a multiple of 8).
  • --rows, -r: Number of rows in the sprite sheet.
  • --cols, -c: Number of columns in the sprite sheet.
  • --output, -o: Output .bas file path.
  • --name, -n: Name prefix for the generated array variables.
  • --no-attributes: (Optional) Skip exporting attribute arrays.

Example

Convert an 8x8 tileset with 1 row and 6 columns:

zxp2boriel -i tileset.zxp -w 8 -r 1 -c 6 -o tileset.bas -n tile

This will generate a tileset.bas file containing individual arrays for each tile:

Dim tile0(7) As Ubyte => { _
	$00,$7E,$42,$5A,$00,$FF,$81,$81 _
}
Dim tileAttr0(0) As Ubyte => { $22 }

Dim tile1(7) As Ubyte => { _
	$00,$00,$00,$00,$00,$00,$00,$00 _
}
Dim tileAttr1(0) As Ubyte => { $22 }

...

Output Format

  • Sprite Data: Each sprite is exported as {name}{index} (e.g., tile0, tile1)
  • Attributes: Each sprite's attributes are exported as {name}Attr{index} (e.g., tileAttr0)
  • Attributes are formatted in a single line for better readability
  • Each sprite and its attributes are grouped together, separated from the next sprite by a blank line

Skipping Attributes

If you don't need color attributes:

zxp2boriel -i sprites.zxp -w 24 -r 2 -c 6 -o sprites.bas -n sprite --no-attributes

License

AGPL-v3

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

zxp2boriel-0.1.9.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

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

zxp2boriel-0.1.9-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file zxp2boriel-0.1.9.tar.gz.

File metadata

  • Download URL: zxp2boriel-0.1.9.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for zxp2boriel-0.1.9.tar.gz
Algorithm Hash digest
SHA256 5b3947821281b638e69533e9527f15b22b1f397c39dbd33fd70c2172be5ed4c8
MD5 eb5aec0e0a295176d0d6adcf28a57231
BLAKE2b-256 5ccdf72bbc7ed30e24ba370595af890470b9dd5c392ae569b2e61692362d3d88

See more details on using hashes here.

File details

Details for the file zxp2boriel-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: zxp2boriel-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for zxp2boriel-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 3714de93aa9ffeef6ec985ef10a7332904e29c044704a216934080348878d0a1
MD5 f1a49bb81958cb8ad0b2c7f74465497b
BLAKE2b-256 db3522bd62b93bb265742a3a9b073919fbdf7386e4ba8389eb84f0e77af1b520

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