Advent of Code® OCR
This Python module converts Advent of Code ASCII art letters to plain characters.
At the moment, it supports 6-pixel-tall characters as seen in 2016 Day 8, 2019 Days 8 and 11, and 2021 Day 13. (Support for 10-pixel-tall characters, as seen in 2018 Day 10, is coming soon.)
Put simply, it converts something like this to plain text:
██ ███ ██
█ █ █ █ █ █
█ █ ███ █
████ █ █ █
█ █ █ █ █ █
█ █ ███ ██
Installation
Advent of Code OCR is available on PyPI:
$ pip install advent-of-code-ocr
Advent of Code OCR officially supports Python 3.7+.
API Reference
By default, this module recognizes # as a filled pixel and . as an empty
pixel. However, you can change this using the fill_pixel and empty_pixel
keywork arguments respectively.
from advent_of_code_ocr import convert_6
print(convert_6(".##.\n#..#\n#..#\n####\n#..#\n#..#"))
# A
print(convert_6(" $$ \n$ $\n$ $\n$$$$\n$ $\n$ $", fill_pixel="$", empty_pixel=" "))
# A
You can also convert data that you have in a NumPy array or a nested list:
from advent_of_code_ocr import convert_array_6
array = [
[0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0],
[1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1],
[1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0],
[1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0],
[1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1],
[1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0],
]
print(convert_array_6(array, fill_pixel=1, empty_pixel=0))
# AOC
Advent of Code is a registered trademark of Eric K Wastl in the United States.
Metadata
Release files for advent-of-code-ocr 1.1.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 | |
|---|---|---|---|
| advent_of_code_ocr-1.1.0.tar.gz | 59.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| advent_of_code_ocr-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 66.2 kB
Release files / advent_of_code_ocr-1.1.0.tar.gz
| Download URL | advent_of_code_ocr-1.1.0.tar.gz |
|---|---|
| Size | 59.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f03373e2d364b30da9a168064ed9342c6e18b7a443f433e551038e8437671ba7
|
|
BLAKE2b-256 checksum How to use checksums |
a49cd0c55e029ade2854def3af78a896e012b4c57d7ef089782f63d34cd6466a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Jul 25, 2025.
Transparency logRelease files / advent_of_code_ocr-1.1.0-py3-none-any.whl
| Download URL | advent_of_code_ocr-1.1.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a5a0668b88e94a8d7319fe024a8840799bf1ba8526fc4a5b5f5178459d678a36
|
|
BLAKE2b-256 checksum How to use checksums |
3ddbeff655bb8654353ad2821a77608c5335769673e22c0f3868c503bd705a03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
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 Jul 25, 2025.
Transparency log