Fancy image to ASCII/ANSI converter
Project description
image2ascii
Converts images to ASCII, with a twist; it traces edges in the image and attempts to render them with suitably formed characters, à la good old handmade ASCII art:
It can also crop, output ANSI colour, adjust contrast/colour balance/brightness, invert, and other nice stuff, as well as render HTML.
Installation
From PyPI
# Minimal install:
pip install image2ascii
# Install with [WSGI](https://wsgi.readthedocs.io/en/latest/) capabilities:
pip install image2ascii[www]
From source
# You do use virtual envs, right?
python3 -m venv .venv
source .venv/bin/activate
./setup.py install
Usage
CLI
Installation per instructions above creates an image2ascii
command; run it for more info. Play around with various combinations of --invert
, --negative
, --contrast
, --brightness
, and --color-balance
, until the results are to your liking. --color
and --crop
are also highly recommended.
WSGI
Image2ASCII can run as a simple WSGI application, courtesy of Flask. Just make sure you have installed it with the necessary extra requirements, either by running pip install image2ascii[www]
or manually installing Flask
and requests
.
Installation via pip install image2ascii[www]
will also create an image2ascii_testserver
command with an optional port number argument (default is port 8000). Use it to fire up a basic web server on localhost and try it out. (Executing wsgi.py
directly from the command line achieves the same thing.)
Here is a suggested (albeit untested) Supervisor setup:
/etc/supervisor/conf.d/image2ascii.ini
:
[program:image2ascii]
directory = /path/to/image2ascii
command = /path/to/image2ascii/.venv/bin/uwsgi --ini config.ini
/path/to/image2ascii/config.ini
:
[uwsgi]
module = image2ascii.wsgi:application
master = true
processes = 5
socket = /tmp/image2ascii.sock
chmod-socket = 666
vacuum = true
Everything else
This project is totally in beta, and so its API should not be considered stable.
Shouts out to:
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
Built Distribution
Hashes for image2ascii-0.4.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 666588561de4141e11ac59a0d9751346ebcc8b98e86997e5da22c2239243cf1c |
|
MD5 | 37dccfac0a91789356107daba54096ff |
|
BLAKE2b-256 | dd0198844e9aebec25054aa8e7f658a7e3ae58cbe4c38ac82b894b1b01207413 |