Skip to content

Using python to generate a set of ascii conveying an image with depth, shadow etc. output of the code will be an .txt file and will be put on the same folder as the image.

Notifications You must be signed in to change notification settings

NarendraYSF/Python-image-to-ascii

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

Image to ASCII Converter

Convert any image into ASCII art with depth and shading. This Python script generates a text file containing ASCII characters that represent your image, preserving visual details like shadows and depth.

Features

  • Converts images to ASCII art while preserving depth and shadows
  • Supports common image formats (JPG, PNG, etc.)
  • Generates output as a text file in the same directory as the input image
  • Simple command-line interface

Prerequisites

  • Python 3.9.10 or later
  • PIL (Python Imaging Library)

Installation

  1. Clone the repository:

    git clone https://github.com/NarendraYSF/Python-image-to-ascii.git
    cd Python-image-to-ascii
  2. Install required dependencies:

    pip install Pillow

Usage

  1. Open your terminal or command prompt

  2. Navigate to the project directory:

    cd path/to/Python-image-to-ascii
  3. Run the script:

    python3 PythonASCII.py
  4. When prompted, enter the path to your image:

    Enter the path to the image file: Image.jpg

Output

The script will generate a text file containing the ASCII art in the same directory as your input image. The output filename will be based on your input image name with a .txt extension.

Example

Input image: python.jpg Alt text

Output file: python.txt

                                +++++*+*****************++***++                                   
                              +++*********************************++                                
                            =****************************************+                              
                           +*******************************************+                            
                          +******=::.:-+********************************+                           
                          +*****-.     .=********************************+                          
                         +*****+.       .*********************************                          
                         +******:.     .-*********************************=                         
                         +*******=.   .=**********************************=                         
                         +*********++*************************************=                         
                         +************************************************=                         
                         +************************************************=                         
                          ++++++++++++++++++++++++************************=                         
                                                 :************************=                         
          +++*************************************************************= .:::::::::::::::        
       =+*****************************************************************= .:::::::::::::::::      
     ++*******************************************************************= .::::::::::::::::::     
    +*********************************************************************= .:::::::::::::::::::.   
   +**********************************************************************= .::::::::::::::::::::   
  +***********************************************************************= .:::::::::::::::::::::  
 =+***********************************************************************  ::::::::::::::::::::::  
 +***********************************************************************+  ::::::::::::::::::::::: 
 +***********************************************************************=  ::::::::::::::::::::::: 
-***********************************************************************=  ::::::::::::::::::::::::.
+*********************************************************************+   ::::::::::::::::::::::::::
+*******************************************************************++  ::::::::::::::::::::::::::::
+**********************************+***************************+*++   ::::::::::::::::::::::::::::::
+******************************+=                                :::::::::::::::::::::::::::::::::::
+***************************+   ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+*************************+   ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
=************************=  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-***********************=  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 +*********************+  .:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
 =*********************=  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
  +********************  .::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::  
  =*******************+  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::.  
   +******************+  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::   
    +*****************+  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::    
     +****************+  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::     
       +**************+  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::       
          =+*++++++++++  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::.         
                         :::::::::::::::::::::::::                                                  
                         :::::::::::::::::::::::::::::::::::::::::::::::::                          
                         ::::::::::::::::::::::::::::::::::::::::::::::::::                         
                         ::::::::::::::::::::::::::::::::::::::::::::::::::                         
                         ::::::::::::::::::::::::::::::::::::::::::::::::::                         
                         :::::::::::::::::::::::::::::::::::.     .::::::::                         
                         ::::::::::::::::::::::::::::::::::.       .::::::                          
                          :::::::::::::::::::::::::::::::::.       .::::::                          
                          ::::::::::::::::::::::::::::::::::.     .:::::::                          
                           :::::::::::::::::::::::::::::::::::...::::::::                           
                             ::::::::::::::::::::::::::::::::::::::::::                             
                               ::::::::::::::::::::::::::::::::::::::                               
                                 ::::::::::::::::::::::::::::::::::                                 
                                      ::::::::::::::::::::::::

Contributing

Feel free to open issues or submit pull requests for any improvements or bug fixes.

License

This project is open source and available under the MIT License.

Author

NarendraYSF

Acknowledgments

Special thanks to the Python Imaging Library (PIL) team for providing the image processing capabilities that make this project possible.

About

Using python to generate a set of ascii conveying an image with depth, shadow etc. output of the code will be an .txt file and will be put on the same folder as the image.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages