PaintByChar
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.
Why PaintByChar?
- Turn a rectangular text grid into a rendered image in a few lines
- Map each character to a color automatically or via your own palette
- Support multiple rendering styles for cells, text, and background-label combinations
- Works well for generative art, puzzle visualizations, and debugging text-based layouts
Features
string_to_image()for direct text-to-image conversionfile_to_image()for processing a text file as a grid- Preset colormaps such as
viridis,plasma, andterrain - Custom
value_colorsdictionaries for full control over mapping - Render modes: filled cells, colored text, and colored cells with background text
Install
pip install paintbychar
Quick example
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")
Example output
More example images
More examples
The repository includes several runnable examples in the examples/ folder, including:
basic_example.pyfile_example.pystyles_example.pypreset_example.pyadvent_of_code_example.py
API reference
See 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
Contributing
Contributions are welcome. See CONTRIBUTING.md for setup instructions, testing guidance, and the pull request process.
Code of conduct
This project follows the Contributor Covenant Code of Conduct.
License
This project is licensed under the MIT License.
Project status
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.
Social preview
A repository preview image is included in assets/social-preview.png and can be used as a GitHub social preview or banner asset.
Metadata
Release files for PaintByChar 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| paintbychar-0.7.0.tar.gz | 9.2 kB | With provenance | Details for paintbychar-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| paintbychar-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for paintbychar-0.7.0-py3-none-any.whl |
Total release size: 16.4 kB
Release files / paintbychar-0.7.0.tar.gz
| Download URL | paintbychar-0.7.0.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93d1825aa3c70a3e7ae80d82219e50b0a45917bcf2a1c3ed0775c730f1e920ca
|
|
BLAKE2b-256 checksum How to use checksums |
5261fa860781418e817a1f3ca85c92b5081c36e77064d77e51c320c01d87b049
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logRelease files / paintbychar-0.7.0-py3-none-any.whl
| Download URL | paintbychar-0.7.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b4e0e4cf12450db8c35e33558a456bb04e205865d415aa3bd5d5b91a7f919b77
|
|
BLAKE2b-256 checksum How to use checksums |
001dd0d6fa9886d604d0b3306d143c1bdc3247f80d3fa48d460bbe7284195917
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logSecurity for PaintByChar 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for paintbychar-0.7.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.