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”.
Options
The tool has to be started with the following options set:
- --file/-f <IMAGE_FILE_TO_LOAD>: the image to charpack
- --screen-output/-s <SCREEN_OUTPUT_FILENAME>: the name of the file to write the screen to
- --charset-output/-c <CHARSET_OUTPUT_FILENAME>: the name of the file to write the charset
Examples
charpacker -f logo.png -s screen.bin -c charset.bin
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.
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.