image2ascii-core
This is a thing that makes fancy ANSI graphics out of image files. And not just by sloppily repeating the same character all over the place; no, it detects transparency and draws edges with .od$$o.o$$bo. etc, like a real little ANSI artist.
It's an almost complete rewrite of an old project of mine. It's pretty versatile. You can adjust sizes, colour balance, contrast, define your own colour converters, shape sets, etc.
There is a CLI tool in a separate repo. More info will probably come soon.
Optimization/benchmarking
Image resizing methods
Benchmarking the different PIL.Image.Resampling methods when downsizing an 1833x1380 image to 18x13:
NEAREST: 3.05 μs ± 50.6 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)
BOX: 3.93 ms ± 48.8 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)
HAMMING: 7.28 ms ± 24 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)
BILINEAR: 7.3 ms ± 137 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)
BICUBIC: 13.3 ms ± 43.2 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)
LANCZOS: 19.5 ms ± 34.2 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)
(NEAREST is more than a thousand times faster than the runner-up!)
And when upsizing the same image to 18300x13800:
NEAREST: 696 ms ± 11.5 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
BOX: 1.75 s ± 11.7 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
BILINEAR: 2.13 s ± 48.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
HAMMING: 2.13 s ± 16.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
BICUBIC: 2.88 s ± 14.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
LANCZOS: 3.69 s ± 121 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
(Just a 2.5x lead for NEAREST here.)
Image section colour inference methods
Inferring colour for an RGBA array of shape=(29, 4):
MEDIAN: 2.11 μs ± 29.1 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)
MOST_COMMON: 25.4 μs ± 910 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
ColorInferenceMethod.MEDIAN is more than 10x faster.
Metadata
Release files for image2ascii-core 0.8.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 |
|---|---|---|---|---|
| image2ascii_core-0.8.0.tar.gz | 248.2 kB | Without provenance | Details for image2ascii_core-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| image2ascii_core-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for image2ascii_core-0.8.0-py3-none-any.whl |
Total release size: 501.2 kB
Release files / image2ascii_core-0.8.0.tar.gz
| Download URL | image2ascii_core-0.8.0.tar.gz |
|---|---|
| Size | 248.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1bc0941344e56436197998611d643a327a21c39c6b6f948e7422d6047e21fca
|
|
BLAKE2b-256 checksum How to use checksums |
a1c47b29798deae97ec8db1b1357be517e0201917c3e2d9244fffb55dcf970a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|
Release files / image2ascii_core-0.8.0-py3-none-any.whl
| Download URL | image2ascii_core-0.8.0-py3-none-any.whl |
|---|---|
| Size | 253.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b6df9b5093d3ac150e267c5d5c5a6780781f7bb9d8a4e96be9fa358e269e9790
|
|
BLAKE2b-256 checksum How to use checksums |
e9fdb9854ab2ccb92ab3e12d0f44081dd75ab95f2072f9da5ab5981422925459
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|
Security for image2ascii-core 0.8.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.