Skip to the content.

Image2ASCII

A Python Learning Project, that recreates an image with text, commonly known as ASCII art.

Requirements

Installation

  1. Clone the repository or download the source code:
git clone https://github.com/Gabriel-Sousa-Amorim/Image2ASCII.git
  1. Navigate to the project directory:
cd Image2ASCII
  1. 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>

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.

              ++              
              ++              
             =++=             
             ++++             
             ++++             
            *+##+*            
            ++ÑÑ++            
            +*ÑÑ*+            
           ==#ÑÑ#==           
%==%%%%%%%%++ÑÑÑÑ++%%%%%%%%==%
++++++======*ÑÑÑÑ*======+++++%
 *+++%Õ@@@@@ÑÑÑÑÑÑ@@@@@Õ%+++* 
   ++*ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ*++   
    +++#ÑÑÑÑÑÑÑÑÑÑÑÑÑÑ#+++    
      ++*ÑÑÑÑÑÑÑÑÑÑÑÑ*++      
       +++ÕÑÑÑÑÑÑÑÑÕ+++       
        ++*ÑÑÑÑÑÑÑÑ*++        
        ==@ÑÑÑÑÑÑÑÑ@==        
        ++ÑÑÑÑÑÑÑÑÑÑ++        
        +*ÑÑÑÑ%%ÑÑÑÑ*+        
       ==#ÑÑÕ++++ÕÑÑ#==       
       ++ÑÑ%+++*++%ÑÑ++       
       ++@*++    ++*@++       
       +++++      +++++       
      ++++          ++++      
      +++            +++      
      +%              %+