Skip to content

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

Notifications You must be signed in to change notification settings

Gabriel-Sousa-Amorim/Image2ASCII

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

  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>
  • Replace <path_to_img> 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.

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

About

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

Topics

Resources

Stars

Watchers

Forks

Languages