Skip to main content

An easy and fun encryption module.

Reason this release was yanked:

FML.

Project description

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 -n uses nearest neighbor to resize the image. (useful if antialiasing makes the output look bad)
  • --posterize -p uses 4-bit posterization on the image. (useful if the image has a lot of different colors)
  • --legacy-palette -l uses 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

img2hbirc-1.0.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

img2hbirc-1.0.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file img2hbirc-1.0.0.tar.gz.

File metadata

  • Download URL: img2hbirc-1.0.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for img2hbirc-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3820dfb49ca69aa2b419242484cfc959c6b2646540d014915e84e0975bdd7814
MD5 e0e19b9e56c947acd4440ab3f47925a6
BLAKE2b-256 7543054013d7270028070686aafb4089cc946d24e337705a179f9c0f5560a3cf

See more details on using hashes here.

File details

Details for the file img2hbirc-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: img2hbirc-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for img2hbirc-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0518352159c264efea4940599ae8bbba26d09b4646b194e46e4d26fd7a183fc
MD5 077e0d39717d3e147c32b0818f47b43f
BLAKE2b-256 9a0551736e728aec82ed4170dd202863808faf984050860dfacbfc5fcea56f8a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page