c64tools

charpacker

Using “charpacker.py”

Charpacking converts a bitmap into a character set and a screen, used either for reducing the overall size, for generating larger fonts, or for allowing other effects, such as changing multi-colours in each raster line.

charpacker.py” loads an image file (.gif, e.g.) and performs the charpacking — indexing same 8×8 pixel characters. It is somehow a Python-version of the original c64 charpacker “Abraham”.

Arguments and options

Arguments

The tool has to be started with the following options set:

  • <INPUT_IMAGE>: the image to load and charpack

Options

  • --screen-output/-S <SCREEN_OUTPUT_FILENAME>: the name of the file to save the screen to
  • --charset-output/-C <CHARSET_OUTPUT_FILENAME>: the name of the file to save the charset to
  • --show/-s: shows the result
  • --version: prints the version information
  • --help/-h: prints the help screen

Examples

charpacker --show -S screen.bin -C charset.bin logo.png

Loads an image from “logo.png”, charpacks it, and writes the resulting screen to “screen.bin” and the resulting charset to “charset.bin”.

A window will be shown, similar to the one shown in the following image.

Charpacker window

The window shows the loaded image three-wise.

  • First, the loaded image as-is is shown.
  • Then, the image converted to b/w is shown.
  • Then, the charpacked image is shown.

Embedding

Besides using the charpacker as a command line application, you may as well import it in your Python application and use the charpack method within a script. You may then incrementally fill a character set from a different bitmaps by passing the results of initial steps as the second parameter.