Asciit is nothing but a python code which reads an image file (.jpg, .png or any other) and generates a .txt file containing ascii characters which looks like original file.
- PIL (Python Imaging Library)
pip3 install pillow
- First, clone the repository at some location.
- To directly get the output on the console, use the following command:
username@PC:~/location/asciit$ python3 asciit.py image_filename
where, image_filename
specifies relative or full path to the original image
- To get output in a separate file, use the following command:
username@PC:~/location/asciit$ $python3 asciit.py image_filename output_filename
where, image_filename
specifies relative or full path to the original image and
output_filename
specifies relative or full path of the .txt file which is to be created
- Refer to the comments for more information on how to use various methods defined in ImageToAscii class
- PIL Image object is passed to convert() method.
- Converts our image to specified width.
- Transforms RGB to grayscale form.
- Converts the grayscale matrix to ascii string according to the intensity.
Image source: Link to the google_logo image