Skip to main content

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


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 details)

Uploaded Source

Built Distribution

numpyasciiart-0.10-py3-none-any.whl (56.2 kB view details)

Uploaded Python 3

File details

Details for the file numpyasciiart-0.10.tar.gz.

File metadata

  • Download URL: numpyasciiart-0.10.tar.gz
  • Upload date:
  • Size: 55.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for numpyasciiart-0.10.tar.gz
Algorithm Hash digest
SHA256 30fd410c2196dbf842e960aaf3fd00c6312a22853fa208590483eb0c2be8931b
MD5 5cf003a2eb281343b5f12a21a02417a9
BLAKE2b-256 6d35ca69aa0c8f6f3a3304b4df2013915eba0e1b3b17401289f3d8df990463d3

See more details on using hashes here.

File details

Details for the file numpyasciiart-0.10-py3-none-any.whl.

File metadata

  • Download URL: numpyasciiart-0.10-py3-none-any.whl
  • Upload date:
  • Size: 56.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for numpyasciiart-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a938f440ef0182447a6d5a00eace9217f96a4e132db8b645a0dc2e849f720b1b
MD5 d7e4fcbb52136180355f247ddb137048
BLAKE2b-256 a928240fae7440128731d251f2c06fe5bb89ee35761fefa2cdf1b64ee332191a

See more details on using hashes here.

Supported by

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