
A tiny Python library for turning ASCII grids into colorful images. It is designed for quick visualizations of mazes, maps, game boards, and Advent of Code-style 2D text puzzles.
string_to_image() for direct text-to-image conversionfile_to_image() for processing a text file as a gridviridis, plasma, and terrainvalue_colors dictionaries for full control over mappingRobotoMono-Regular.ttf
pip install paintbychar
import paintbychar as pbc
grid = """0123
4567
89AB
"""
img = pbc.string_to_image(
grid,
preset="viridis",
cell_size=24,
render_style=pbc.RenderStyle.COLORED_CELLS,
)
pbc.save_image(img, "output_basic.png")
The repository includes several runnable examples in the examples/ folder, including:
basic_example.pyfile_example.pystyles_example.pypreset_example.pyadvent_of_code_example.pySee the documentation for a quick overview of the public functions and options, or browse the live docs site.
There is also documentation on Read the Docs with installation instructions, usage examples, and API reference. Read the Docs
Contributions are welcome. See CONTRIBUTING.md for setup instructions, testing guidance, and the pull request process.
This project follows the Contributor Covenant Code of Conduct.
This project is licensed under the MIT License.
The bundled Roboto Mono font is separately licensed under the SIL Open Font License (OFL). See src/fonts/OFL.txt for its license terms.
PaintByChar is currently a small, focused library aimed at grid-based text rendering and visualization. It is suitable for personal, educational, and open-source use, and is prepared for broader community contributions as it matures.
A repository preview image is included in assets/social-preview.png and can be used as a GitHub social preview or banner asset.