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.
- 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
- Python 3.9.10 or later
- PIL (Python Imaging Library)
-
Clone the repository:
git clone https://github.com/NarendraYSF/Python-image-to-ascii.git cd Python-image-to-ascii
-
Install required dependencies:
pip install Pillow
-
Open your terminal or command prompt
-
Navigate to the project directory:
cd path/to/Python-image-to-ascii
-
Run the script:
python3 PythonASCII.py
-
When prompted, enter the path to your image:
Enter the path to the image file: Image.jpg
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.
Output file: python.txt
+++++*+*****************++***++
+++*********************************++
=****************************************+
+*******************************************+
+******=::.:-+********************************+
+*****-. .=********************************+
+*****+. .*********************************
+******:. .-*********************************=
+*******=. .=**********************************=
+*********++*************************************=
+************************************************=
+************************************************=
++++++++++++++++++++++++************************=
:************************=
+++*************************************************************= .:::::::::::::::
=+*****************************************************************= .:::::::::::::::::
++*******************************************************************= .::::::::::::::::::
+*********************************************************************= .:::::::::::::::::::.
+**********************************************************************= .::::::::::::::::::::
+***********************************************************************= .:::::::::::::::::::::
=+*********************************************************************** ::::::::::::::::::::::
+***********************************************************************+ :::::::::::::::::::::::
+***********************************************************************= :::::::::::::::::::::::
-***********************************************************************= ::::::::::::::::::::::::.
+*********************************************************************+ ::::::::::::::::::::::::::
+*******************************************************************++ ::::::::::::::::::::::::::::
+**********************************+***************************+*++ ::::::::::::::::::::::::::::::
+******************************+= :::::::::::::::::::::::::::::::::::
+***************************+ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+*************************+ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
=************************= ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
-***********************= :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+*********************+ .::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
=*********************= :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+******************** .::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
=*******************+ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::.
+******************+ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+*****************+ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+****************+ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+**************+ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
=+*++++++++++ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::.
:::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::. .::::::::
::::::::::::::::::::::::::::::::::. .::::::
:::::::::::::::::::::::::::::::::. .::::::
::::::::::::::::::::::::::::::::::. .:::::::
:::::::::::::::::::::::::::::::::::...::::::::
::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::
Feel free to open issues or submit pull requests for any improvements or bug fixes.
This project is open source and available under the MIT License.
NarendraYSF
Special thanks to the Python Imaging Library (PIL) team for providing the image processing capabilities that make this project possible.