Convert image to ascii/unicode ANSI sequence
Project description
img2ansi is a simple package containing three CLI to convert an image to an ASCII, BRAILE/DOT, BLOCK representation with support for ANSI escape code sequence
Installation
$ Python3 -m pip install img2ansi
Features
- ASCII convertion
- BRAILE/DOT convertion
- Block convertion
- Custom ASCII character set
- Invert character set
- No echo / echo to terminal
- Resize of image
- Save to a file
- True color
ANSI support
- Bold
- Blink
- True color Foreground
- True color Background
Todo
- Simple Ascii convertion
- Color support
- Multiple file handling
- Simple animation
Usage
img2ansi contains three modules to perform different kind of convertion -img2ascii -img2braile -img2block
usage: img2ascii [-h] [-a Character Set] [-F R G B] [-B R G B] [-b] [-c] [-f]
[-i] [-k] [-n] [-r Width Height] [-o [output filename]]
inputImage
Convert img to Ascii representation
positional arguments:
inputImage image to be converted
optional arguments:
-h, --help show this help message and exit
-a Character Set, --asciicharset Character Set
ascii character set (default : " .~*:+zM#&@$" )
-F R G B, --frgdcolor R G B
All characters with RGB24 foreground color
-B R G B, --bkgdcolor R G B
All characters with RGB24 background color
-b, --bold bold flag
-c, --color foreground text as img colors
-f, --fullscreen fullscreen flag
-i, --invertPattern "invert ascii character set
-k, --blink blink flag
-n, --noecho no echo flag
-r Width Height, --resize Width Height
resize image (0 0 keeps original size), if given -r
100 0 keeps aspectratio with 100px width
-o [output filename], --save [output filename]
save file (if no output filename) defaults to
ascii.txt
By default uses parameters -r 0 0 -a " .~*:+zM#&@$"
usage: img2braile [-h] [-b] [-F R G B] [-B R G B] [-f] [-i] [-k] [-n]
[-r Width Height] [-o [output filename]] [-t Threshold]
inputImage
Convert img to Braile representation
positional arguments:
inputImage image to be converted
optional arguments:
-h, --help show this help message and exit
-b, --bold bold flag
-F R G B, --frgdcolor R G B
All characters with RGB24 foreground color
-B R G B, --bkgdcolor R G B
All characters with RGB24 background color
-f, --fullscreen fullscreen flag
-i, --invertPattern "invert Braile characters flag
-k, --blink blink flag
-n, --noecho no echo flag
-r Width Height, --resize Width Height
resize image (0 0 keeps original size), if given -r
100 0 keeps aspectratio with 100px width
-o [output filename], --save [output filename]
save file (if no output filename) defaults to
braile.txt
-t Threshold, --threshold Threshold
set threshold to binarize img in braile convertion
(0-255)
By default -r 0 0 -t 127
usage: img2block [-h] [-f] [-W] [-k] [-n] [-r Width Height]
[-o [output filename]]
inputImage
Convert img to Block representation
positional arguments:
inputImage image to be converted
optional arguments:
-h, --help show this help message and exit
-f, --fullscreen fullscreen flag
-W, --wholeblock "Use one block per terminal cell
-k, --blink blink flag
-n, --noecho no echo flag
-r Width Height, --resize Width Height
resize image (0 0 keeps original size), if given -r
100 0 keeps aspectratio with 100px width
-o [output filename], --save [output filename]
save file (if no output filename) defaults to
block.txt
By default uses 2 blocks per terminal cell and -r 0 0
License
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
img2ansi-0.1.2.tar.gz
(18.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
img2ansi-0.1.2-py3-none-any.whl
(23.0 kB
view details)
File details
Details for the file img2ansi-0.1.2.tar.gz.
File metadata
- Download URL: img2ansi-0.1.2.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.7 Linux/5.10.79-1-MANJARO
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a1e5c9da567f3f824d55835682c3a63524406758509e228a919e5bbb2010d84
|
|
| MD5 |
022e030ff29a4d4f77517153593ded25
|
|
| BLAKE2b-256 |
18377f0524da876996aee8b1b12dfe524fd043ac03b46ef7521b24c0d9c1c926
|
File details
Details for the file img2ansi-0.1.2-py3-none-any.whl.
File metadata
- Download URL: img2ansi-0.1.2-py3-none-any.whl
- Upload date:
- Size: 23.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.7 Linux/5.10.79-1-MANJARO
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02f88f481693d46b7a2e78ec04e88f1f4c2b69201dd61aeed4886f512e279188
|
|
| MD5 |
4f85c371d2aafa680a9fbb8ac0e06fb1
|
|
| BLAKE2b-256 |
35cb2f7123d9a167f3fc60b43aed156cd3456f7881e9cb4d88ed437041f346d0
|