/image_to_ascii

A python script that converts images and gifs to ASCII

Primary LanguagePython

Image to ASCII

This program converts images and gifs to ASCII
It can also display them in the terminal

demo demo2 demo3

Prerequisites

Python==3.8.1
Pillow==7.0.0
Requests==2.22.0

Usage

ascii.py

It accepts images and gifs. You can specify the path or link (ending in .jpg/.png/.gif ...)
Example: python ascii.py /path/to/file.png / python ascii.py https://site.domain/file.gif

You can specify the scale, reverse, chars, rotate, contrast and wide arguments
scale {integer} - scales the source file to the integer specified
Example: python ascii.py /path/to/file.gif scale 75
reverse - swaps black&white for the given file
Example: python ascii.py /path/to/file.gif reverse scale 10
chars {'string'} - specifies the characters for conversion
Example: python ascii.py /path/to/file.jpg chars ' $@B%8&WM#' (default is ' :co@')
rotate {'string'} - rotates the characters by either -90 or 90 degrees; the accepted values are 'left' and 'right'
Example: python ascii.py /path/to/file.jpg rotate left
contrast - converts using these characters ' ░▒▓█'; this will override the chars arguments
Example: python ascii.py /path/to/file.jpg contrast
wide {int} - specifies how wide each cell will be
Example: python ascii.py /path/to/file.jpg wide 3 (default is 2)

All arguments can be nested and combined

show.py

Displays the image/gif in the terminal. For gifs, it will infinitely loop through the frames
Example: python show.py

usage: show.py [-h] [-d [f]] [-c [{BLUE,GREEN,YELLOW,RED}]] [folder]

Show computed ASCII image or gif.

positional arguments:
  folder                folder containing the computed output.

optional arguments:
  -h, --help            show this help message and exit
  -d [f], --delay [f]   delay between frames, default is 0.07 seconds.
  -c [{BLUE,GREEN,YELLOW,RED}], --colour [{BLUE,GREEN,YELLOW,RED}]

skull.gif