Image2ASCII
A Python Learning Project, that recreates an image with text, commonly known as ASCII art.
Requirements
- Python 3.4+ (recommended Python 3.4 or later)
- Pip (required if using Python below 3.4)
- Git (optional for cloning the repository)
Installation
- Clone the repository or download the source code:
git clone https://github.com/Gabriel-Sousa-Amorim/Image2ASCII.git
- Navigate to the project directory:
cd Image2ASCII
- Install requirements:
pip install -r requirements.txt
Usage
To generate ASCII art from an image, run the following command:
python3 main.py <path_to_img> <size>
- Replace
with the path to your image file (local or URL). Note: URL images may cause 403 and 404 errors. - Replace
with a divisor for the image dimensions.
For example, if the image is 1000x1000 and you want a 500x500 ASCII output, set the size to 2.
python3 main.py ./images/sample.jpg 2
Running Tests
Check the tests/ folder for example outputs.
++
++
=++=
++++
++++
*+##+*
++ÑÑ++
+*ÑÑ*+
==#ÑÑ#==
%==%%%%%%%%++ÑÑÑÑ++%%%%%%%%==%
++++++======*ÑÑÑÑ*======+++++%
*+++%Õ@@@@@ÑÑÑÑÑÑ@@@@@Õ%+++*
++*ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ*++
+++#ÑÑÑÑÑÑÑÑÑÑÑÑÑÑ#+++
++*ÑÑÑÑÑÑÑÑÑÑÑÑ*++
+++ÕÑÑÑÑÑÑÑÑÕ+++
++*ÑÑÑÑÑÑÑÑ*++
==@ÑÑÑÑÑÑÑÑ@==
++ÑÑÑÑÑÑÑÑÑÑ++
+*ÑÑÑÑ%%ÑÑÑÑ*+
==#ÑÑÕ++++ÕÑÑ#==
++ÑÑ%+++*++%ÑÑ++
++@*++ ++*@++
+++++ +++++
++++ ++++
+++ +++
+% %+