Lynn's Ascii Art Converter is a Python script that converts an image into reasonably high resolution colored ASCII art and generates an HTML file with the output. It provides a fun and creative way to transform images into ASCII representations.
-
Clone the repository to your local machine using the following command:
shell
-
git clone https://github.com/LynnColeArt/AsciiArtConverter.git
- Navigate to the project directory:
shell
-
cd ascii-art-converter
-
Create a virtual environment to install the dependencies. You can use either
venv
orconda
: -
Using
venv
:shell
python3 -m venv env source env/bin/activate
-
Using
conda
:
shell
-
-
conda create --name ascii-converter python=3.9 conda activate ascii-converter
-
Install the required dependencies using
pip
:
-
shell
-
pip install -r requirements.txt
This will install the necessary packages, including
argparse
,Pillow
, andnumpy
.
To convert an image to colored ASCII art and generate the HTML output, follow these steps:
-
Place your image file in the project directory or provide the relative path to the image file.
-
Open a terminal or command prompt and navigate to the project directory:
shell
-
cd ascii-art-converter
- Run the Python script using the following command:
shell
python art.py image_path
Replace image_path
with the relative path to your image file. For example:
shell
-
python ascii_converter.py images/my_image.png
This will convert the image to colored ASCII art and generate an HTML file named after your original file, but with the .html extension.
-
Open the file in a web browser to view the generated ASCII art.
-
ASCII Characters: The script uses a predefined set of ASCII characters to represent different levels of pixel intensity. You can modify the
ascii_chars
variable in theascii_converter.py
file to use your preferred characters. Ensure that the characters are arranged in ascending order of intensity. -
Output Size: By default, the script resizes the image to a fixed size of 320x160 pixels. If you want a different size for your ASCII art, modify the
resize
function call in theascii_converter.py
file.
This project is licensed under the MIT License. Feel free to use and modify it according to your needs.