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

Uploaded Source

Built Distribution

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

Uploaded Python 3

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