pyrexpaint
is a small API for loading .xp files into python programs. So small, there is a single function provided called load
.
An .xp file is the custom binary format used by the ASCII art editor REXPaint.
pip install pyrexpaint
or install from source:
git clone https://github.com/mattlink/pyrexpaint
pip install ./pyrexpaint
Say you have an .xp file hello.xp
in the same directory as your program, it can be loaded using:
import pyrexpaint
image_layers = pyrexpaint.load("hello.xp")
The data structure returned by load
is as follows:
@dataclass
class Tile:
ascii_code: str
fg_r: str
fg_g: str
fg_b: str
bg_r: str
bg_g: str
bg_b: str
@dataclass
class ImageLayer:
width: int
height: int
tiles: List[Tile]
def load(file_name: str) -> List[ImageLayer]:
...
cd ./pyrexpaint/examples
python hello-ncurses.py