- Uniramp
=
Unicode+
Ramp- Ramp: A char sequence for representing levels of gray values
- “Standard” character ramp:
$@B%8&WM*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:,"^`'.
- Support unicode character ramp information
- Uniramp also provides the image-to-text script as a test ground
- An
ASCII“Unicode” art generator
- An
- Most of image-to-text tools do not support custom charset
- Either unicode characters, e.g., CJK characters
- Also, the ramp lacks font information
- A single character have different shapes over various fonts
Install required packages:
Ubuntu 20.04:
apt install git \
cmake \
g++ \
python3-dev \
pybind11-dev \
libfreetype-dev \
python3-distutils \
python3-pil
Clone the repo and build it:
git clone https://github.com/Cycatz-nycu/uniramp
cd uniramp
make
Run it with the example font:
python3 -m uniramp ramp -f tests/NotoSansCJK-Regular.ttc
Prefix arguments with python -m uniramp
to use the program:
python -m uniramp -h
usage: __main__.py [-h] {ramp,image} ... positional arguments: {ramp,image} ramp Print ramp infomation image Convert an image to chars options: -h, --help show this help message and exit
python -m uniramp ramp --help
:
usage: __main__.py ramp [-h] -f FONT [-c CHARACTER_SET] [-g] [-w WIDTH] options: -h, --help show this help message and exit -f FONT, --font FONT specify the font file -c CHARACTER_SET, --character-set CHARACTER_SET specify the character set (default is [a-z][A-Z]) -g, --graph Print ramp graph -w WIDTH, --width WIDTH specify the ramp bar width (default is 160 half-width characters)
python -m uniramp image --help
:
usage: __main__.py image [-h] -i IMAGE -f FONT [-c CHARACTER_SET] [-r] [-w WIDTH] [-o OUTFILE] options: -h, --help show this help message and exit -i IMAGE, --image IMAGE specify the image -f FONT, --font FONT specify the font file -c CHARACTER_SET, --character-set CHARACTER_SET specify the character set (default is [a-z][A-Z]) -r, --reverse reverse the ramp order -w WIDTH, --width WIDTH specify the generated image width (default is 80 characters) -o OUTFILE, --outfile OUTFILE specify the output file (default the generated image will be printed to stdout)
- Inconsolata Regular:
- Source Code Pro Regular:
- Fira Code Regular:
- Noto Serif CJK TC Regular (思源宋體)
- Noto Sans CJK TC Regular (思源黑體)
- Maximum/Minimum coverage rate analysis
- Half-width/full-width characters mixing
- Color support (ANSI escape sequences!)
- Conversion from generated text art back to an image