img2hbirc
Image to Half-block ANSI art with IRC color codes.
Installation
As a CLI app
pipx install img2hbirc
As a module
pip install img2hbirc
CLI Usage
Simply convert using
img2hbirc image.png
Output will look weird in terminal, so you can also put it in a file
img2hbirc -o image.txt image.png
Then you can upload it so an IRC bot can output it.
Flags:
--nearest -nuses nearest neighbor to resize the image. (useful if antialiasing makes the output look bad)--posterize -puses 4-bit posterization on the image. (useful if the image has a lot of different colors)--legacy-palette -luses the legacy 16-color mIRC color palette instead of the 84 other colors.--width <int> -s <int>set the width of the image (default: 64), a high number might cause the IRC network to truncate your message.
Module usage
Convert RGB color to IRC control code
from img2hbirc import rgb2irc
# Regular way
print( rgb2irc(255, 0, 0) )
# mIRC palette
print( rgb2irc(255, 0, 0, legacy=True) )
You only get the color number as a string, so you have to embed it like
f"\x03{rgb2irc(255, 0, 0)}This text is red!\x01"
Convert Image
from img2hbirc import convert
from io import BytesIO
print( convert("path") )
# The path can be anything Pillow supports, so BytesIO works as well
print( convert(BytesIO(b"....")) )
# With all the default values included
print(
convert(
"path",
nearest=False,
post=False,
legacy=False,
size=64
)
)
# Works the same way the CLI does, I don't need to document the parameters again.
Metadata
Release files for img2hbirc 1.0.1
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 |
|---|---|---|---|---|
| img2hbirc-1.0.1.tar.gz | 7.7 kB | Without provenance | Details for img2hbirc-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| img2hbirc-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for img2hbirc-1.0.1-py3-none-any.whl |
Total release size: 16.0 kB
Release files / img2hbirc-1.0.1.tar.gz
| Download URL | img2hbirc-1.0.1.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f03f3e02b2269e637d5c99a834be7ae21ca7a49f138b92560a6749f7564426de
|
|
BLAKE2b-256 checksum How to use checksums |
6cad62c46b04b5475cb91754b382a0435ac88d9d865f1c4349ce5d6630542fb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.24
|
Release files / img2hbirc-1.0.1-py3-none-any.whl
| Download URL | img2hbirc-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11d20b3b4025863d73962ece67c8a97e9a4d2211084bd5dbd70473c39566a159
|
|
BLAKE2b-256 checksum How to use checksums |
e086b86e033e5bb803ab7998214f06d01b677a083946ea2bedac7412714c4b23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.24
|
Security for img2hbirc 1.0.1
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.