ASCII art Python library
Project description
asciimage
A library designed in python to convert images into ascii paintings.
To install:
pip install asciimage
pip install docx
pip install python-docx
For more exmamples or if you are still struggling with installation check out the Jupyter notebook <a href= >
Table of Contents
Installation
The repository contains a zipped file of my Python package asciimage and should be installed via pip.
Instalation procedure:
pip install asciimage
pip install docx
pip install python-docx
#The docx and python-docx libraries must be installed
Motivation
The package is intended as a simple drawing tool that produces ASCII art.
The user will upload an image. The image has to be a jpg or png image. The image should have a nice contrast for proper output.
The package contains the function make_ascii_image() which produces ascii art
Example
This is the way to run the module:
from asciimage import *
from PIL import Image #import the module
image_path = r"input_image.jpg"
file_path = r"output.txt" #'output.txt' is the destination where the ASCII art will be stored
ascii_char = list(",.")
height = 400 #intended height of output file
width = 400 #intended width of output file
art = asciimage(image_path,file_path,ascii_char,height,width) #optional: ascii_char,height,width
art.make_ascii_image()
#for colored ascii image
from PIL import Image
from docx import *
from docx.shared import *
image_path = r"input_image.jpg"
file_path = r"output.doc" #'output.doc' is the destination where the ASCII art will be stored
art = asciimage(image_path,file_path) #compulsory: image_path,file_path
#this function outputs a doc file only
art.make_colored_ascii(64)#produces 64X64 image;
Sample
Input Image:
Output text file:
Colored ASCII Input Image:
Output doc file:
If you like the library, please consider giving it a star on Github :)
Troubleshooting
This is a common error:
If this happens, it is because of python-docx not being installed. In that case, please proceed with:
pip install python-docx
pip install docx
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
Built Distribution
Hashes for asciimage-3.141592-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f21bead3147319347b2500aff34fe2a54984a546484b0b5fac0667463da0e2a |
|
MD5 | f321778586fcd9394b2ace60e6316a63 |
|
BLAKE2b-256 | 009086d568eab67e781673116a0333a0aa3b8377bbf8b0550291650608888760 |