Converts images to braille patterns
Requires Python 3.6+ to run
To download the program, create a virtual enviorment and install required packages run this:
git clone https://github.com/Sateviss/braillify
cd braillify
python3 -m venv venv
./venv/bin/pip3 install -r requirements.txt
chmod +x braillify.py && ./braillify.py -h
You can run the sample by running this in your terminal
./braillify.py -i sample.jpg -s=0.9 -w 60 -t
Running the sample should give you something like this:
$ ./braillify.py -i sample.jpg -s=0.9 -w 60 -t
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣤⣤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⡿⣞⣯⣿⣻⡷⣤⣠⣤⣤⡴⣶⢶⡶⣶⢶⡶⣤⣤⣤⣴⢾⣻⣽⡷⣿⢾⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣻⣟⣯⣿⣳⣿⣻⣽⣾⢷⣿⣻⣟⣿⣻⣟⣿⢯⣷⢿⡾⣿⣻⣽⣟⣿⣻⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣯⣿⣽⣾⣯⣿⡽⣟⣾⣿⡽⣯⡿⣾⣯⢿⡾⣟⣿⣻⣟⣯⡿⣷⢿⣽⣯⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⢿⡾⣷⢿⣞⣷⣯⡿⣿⣽⡾⣟⣯⣿⣻⡾⣟⣿⢿⣽⣯⣿⡽⣟⣿⣻⡷⣿⢾⣳⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣻⣯⣿⣻⣯⡿⣷⣻⡿⣽⣾⣟⣿⢯⣿⡽⣟⣿⣽⣟⣷⢿⣞⣿⣻⣽⡷⣿⣻⣟⣿⢷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣽⡾⣯⣷⢿⠝⡉⠅⠨⠀⡂⢐⠠⢉⠊⠍⠩⠑⡐⢀⠂⠡⠐⠠⢉⢙⠻⣯⣿⣽⣾⢿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⢾⣻⣯⡟⢁⠐⠠⠈⡀⡄⡀⠂⡐⢀⠂⠡⢈⠐⡀⢂⠨⢀⡠⣀⠐⠀⢂⠙⣷⡿⣾⣟⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣟⣯⣷⡇⠐⡈⠀⢰⢠⢣⡣⢀⠐⠠⢈⠐⡀⢂⠐⠠⠀⡇⡜⣜⠄⠐⢀⠂⣹⣟⣿⢾⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠄⠀⠀⠒⠂⠀⠀⠀⠀⣀⣀⡈⢿⣽⡷⣇⠂⠄⡁⠀⠳⠱⠉⠀⠌⢐⠀⡂⡐⠠⠈⠄⡁⠑⠝⠜⠀⠐⡀⠂⣿⣽⣯⠏⢀⣀⣀⠀⠀⠀⠀⠒⠂⠀⠀⠤⠀⠀
⠀⠀⠀⠐⠂⠀⠉⠁⠀⠀⠀⠀⠀⠀⠀⠫⣿⣟⣦⡂⢐⠠⠠⠀⠄⠡⠈⠄⠂⡑⠡⡈⠄⠡⠀⡂⠠⠀⠄⠡⢀⣽⣟⡷⠋⠀⠀⠀⠀⠀⠀⠀⠈⠁⠀⠐⠂⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠫⢿⣶⣴⣤⣁⣌⡠⢁⠂⠡⠑⠈⠄⠨⠀⢅⣐⣈⣤⣥⣾⡟⠏⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⢯⣖⣄⠀⠀⠀⠀⠀⠈⠈⠉⢙⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⡋⠉⠁⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢷⣗⣄⠀⠀⠀⠀⠀⣰⣟⣷⣟⣿⢷⡿⡾⣷⢿⣞⣯⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⢷⣾⣥⣶⣤⣷⣿⣽⢷⢹⣽⣟⡇⢸⣿⣻⠙⣯⣷⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠉⠉⠁⣿⢾⣿⠰⣿⢾⡇⢸⣯⣿⠀⣿⣳⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣻⣽⢘⣿⣻⡇⣸⡿⣾⠀⣿⣽⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠄⠠⢐⠠⡿⣯⣿⢸⣯⣿⡃⣼⣟⣿⠀⣿⡾⣇⢐⢀⠂⠄⡀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⡂⠅⡐⠨⠈⣤⡶⣿⠻⠡⢸⣷⣟⡇⢺⣽⢿⡀⠝⠿⣻⣦⡔⢈⢐⢀⠂⠌⡠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢂⢐⠐⡠⠁⢅⠐⠨⡠⡑⠥⡾⠷⢛⢀⢊⢛⠿⣳⠔⡑⠔⡐⠠⠁⠔⡀⢊⠐⡐⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠂⠂⡁⡂⠌⢂⠢⡊⢌⢐⠅⢕⢐⠐⢔⠡⢂⢑⠌⡂⡂⠡⠁⠅⠐⠄⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠁⠈⠂⠂⠑⠁⠂⠘⠀⠑⠐⠐⠁⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
Done in 0.104 s
In this example options used are:
-s=0.9
scales the image vertically by 90%-w 60
sets output width to 60 characters-t
times execution-i sample.jpg
path to image on disk ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
You can also use images directly from the Internet ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
$ ./braillify.py -s=0.9 -w=40 --inv -c=1.5 -i https://images.pexels.com/photos/1809611/pexels-photo-1809611.jpeg
⠀⠀⡀⢀⢀⠠⠀⠠⠀⠄⠠⢀⠠⢀⠄⠄⡐⠀⠄⠂⠄⠂⡠⠠⠐⠠⠐⡀⠄⠄⠄⠠⠀⠄⡀⠄⢀⠠⠀⠀
⢀⠁⠄⢐⠠⢐⠈⠄⠅⢌⢐⢐⠐⠄⡂⡂⡂⢅⠊⢌⢐⠡⡐⢄⠕⡨⢐⢐⠄⠅⢌⠂⠅⡂⢂⠌⡠⢀⠂⡁
⢐⠨⠨⡐⡐⡐⢌⠌⡌⡂⢆⢪⢘⢌⠢⡢⡊⡢⡑⢕⢌⢒⢌⢆⢕⢌⠆⡕⢌⡊⡢⡑⡅⡪⡐⢌⢂⠢⡨⠠
⢰⠡⡑⡔⡑⡌⢆⢣⢊⢎⢆⢕⢜⢔⢕⢜⢔⢕⢕⢕⢜⢜⢌⢎⢖⢅⢧⢱⢱⢊⢎⡢⢕⠬⡸⡐⠥⡱⠨⡊
⢱⢡⢣⢱⢱⢸⢸⢸⢸⢸⢸⡸⡜⣜⢼⢜⢞⢎⢧⣫⡺⣜⣕⢧⢳⡱⡱⣕⣕⢵⢱⢕⢕⢕⢕⢕⢍⢎⢎⢜
⢕⢕⢕⢕⣕⢕⣕⢵⢝⣜⢮⡪⡯⣺⠕⠯⠓⠫⠳⣳⣝⢮⢮⡳⣳⡹⡕⡗⡮⢮⡳⣕⢇⡗⡵⡱⡱⡱⡱⡱
⡕⡽⡸⣕⢮⢳⣱⢳⢝⡮⣺⡺⡽⠁⠀⠀⠀⠀⠀⠈⠺⣝⢷⣝⣞⢮⣻⡪⣏⡧⡯⡮⡳⣕⣝⢎⢧⢫⡪⣪
⡝⡮⡳⣕⢗⢽⢜⡽⣕⡯⡳⠙⠀⠀⠀⠀⠀⠀⠀⠀⠀⠩⣗⣷⣫⣟⡮⣟⣞⣞⣗⡽⣕⣗⢵⡝⣎⢧⡫⣎
⣝⢮⡫⡮⡯⣫⢗⣽⡺⣎⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣞⡾⣾⢽⣗⣯⣾⣺⢽⣳⢽⣳⣫⢗⡷⣝⢮
⡮⣳⣝⢽⢽⣺⢽⣺⡽⣽⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣽⢾⣻⣽⡟⠪⠅⠳⣻⣽⣞⣿⣺⣺⣝⡾⣵⣫
⡯⣞⢾⣝⣯⢾⢯⣷⣻⣽⣗⣷⣦⣤⡠⡄⠀⠀⠀⠀⠀⠿⠿⠟⣿⣷⣿⢄⠀⠀⣟⣾⣳⣷⣻⣺⢮⣷⣳⣳
⣟⢾⡽⣺⣞⣯⣿⣺⣟⣾⣻⣾⡷⡿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣾⣿⡌⠀⢯⣿⣽⡾⣽⣾⣻⣞⣾⣺
⡯⣗⣿⡽⣾⣳⣟⣷⣟⣯⣿⢷⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⠇⠀⣿⣻⣾⣟⣿⣞⣷⣻⣞⡾
⡿⣽⣞⣿⣽⣿⣽⣿⣽⣿⣻⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠀⠀⣿⣟⣯⣿⣾⣻⡾⣗⣯⣿
⣟⣷⣟⣷⡿⣾⡿⣾⣟⣿⣿⣻⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⢿⣿⣾⣟⣿⣿⣽⣾
⣿⢷⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⡿⣟⣯⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣄⠀⠀⠀⠀⠀⠀⠀⠀⠄⠀⠀⢰⣤⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣗⣿⢝⣻⢿⢿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣾⣝⣞⡻⣷⣽⣿⣿⣿⣿⣻⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⠁⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣻⣟⣦⡛⠷⡿⣿⢧⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣚⢳⠍⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠁⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡜⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡂⠄⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⠻⠛⢛⠿⠿⡿⡿⠟⠿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⠀⠀⠀⠀⠁⠈⠀⠁⠁⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠿⠛⠻⠻⠛⠟⠏⠟⠻⡹⢽
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠨⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
In this example options used are:
-s=0.9
scales the image vertically by 90%-w=40
sets output width to 40 characters, which is not necessary, since 40 is the default value--inv
inverts the image, i.e. black pixels become white and vice versa-c=1.5
sets image contrast to 150%-i url
path to image
Distributed under GPL 3.0, see LICENSE.txt for more information