Converts an image to ASCII art using numpy / numexpr / cv2
Project description
Converts an image to ASCII art using numpy / numexpr / cv2
Tested against Windows 10 / Python 3.11 / Anaconda
pip install numpyasciiart
Convert an image to ASCII art.
Parameters:
img (str or numpy.ndarray): url/path/base64/bin/np.array/PIL.Image representing an image.
width (int): Width of the ASCII art output.
height_adjust_stretch (float): Vertical stretch factor for the ASCII art.
letters (str): The set of characters to use for varying shades in the ASCII art.
Returns:
str: ASCII art representation of the input image.
Example:
To convert an image and print it as ASCII art:
from numpyasciiart import to_ascii
pic = to_ascii(
img=r"https://www.python.org/static/img/python-logo.png",
width=160,
height_adjust_stretch=2.5,
letters="█▓▓▒▒░░ ",
)
print(pic)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
numpyasciiart-0.10.tar.gz
(55.3 kB
view hashes)
Built Distribution
Close
Hashes for numpyasciiart-0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a938f440ef0182447a6d5a00eace9217f96a4e132db8b645a0dc2e849f720b1b |
|
MD5 | d7e4fcbb52136180355f247ddb137048 |
|
BLAKE2b-256 | a928240fae7440128731d251f2c06fe5bb89ee35761fefa2cdf1b64ee332191a |