The ASCII Art Generator is a Python module that allows you to convert images into ASCII art. It provides a simple and customizable way to transform images into text-based representations, suitable for various creative and visual purposes.
- Resize images while maintaining their aspect ratio.
- Convert images to grayscale for better representation.
- Generate ASCII art using a default or custom set of ASCII characters.
- Option to save the generated ASCII art to a text file.
- Command-line interface for easy usage.
- Make sure you have Python 3.x installed on your system.
- Clone or download this repository to your local machine.
- Open a terminal and navigate to the project directory.
- Install the required dependencies using the following command:
pip install -r requirements.txt
The ASCII Art Generator can be used both as a standalone script and as a Python module. Here are some examples of how to use it:
To generate ASCII art from an image using the command line, navigate to the project directory and use the following command:
python ascii_art_generator.py input_image_path [--output_width OUTPUT_WIDTH] [--ascii_chars ASCII_CHARS] [--output_file OUTPUT_FILE]
input_image_path
: Path to the input image.--output_width
: Width of the output ASCII art (default is 64).--ascii_chars
: Custom ASCII characters for the art (default is predefined set).--output_file
: Path to save the ASCII art as a text file.
Example:
python ascii_art_generator.py input.jpg --output_width 80 --ascii_chars "@#* ."
You can also use the ASCII Art Generator as a Python module within your own scripts:
from ascii_art_generator import load_image, generate_ascii_art, save_ascii_art_to_file
input_image = load_image("input.jpg")
ascii_art = generate_ascii_art(input_image, output_width=80, ascii_chars="@#* .")
save_ascii_art_to_file(ascii_art, "output.txt")
This project is licensed under the MIT License.
The ASCII Art Generator module uses the following third-party libraries:
- PIL (Pillow): Python Imaging Library for image manipulation.
- NumPy: Scientific computing library for numerical operations.
If you have any feedback, suggestions, or would like to contribute to this project, feel free to open an issue or submit a pull request. Your contributions are highly appreciated!
Enjoy creating fascinating ASCII art with the ASCII Art Generator module!