This is a Python script that converts images to ASCII art and plays them as an animation. The script utilizes the Python Imaging Library (PIL) to process the images and generate the ASCII representation.
- Python 3.x
- PIL (Python Imaging Library)
- Make sure you have Python installed on your system.
- Install the required PIL library by running the following command:
pip install pillow
- Save the script to a file with a .py extension, e.g., image_to_ascii.py.
- Create a folder named images in the same directory as the script.
- Place the images you want to convert to ASCII art in the images folder. Ensure that the images are in .jpg format.
- Open a command prompt or terminal and navigate to the directory containing the script and the images folder.
- Run the script using the following command:
python image_to_ascii.py
- The script will convert the images in the images folder to ASCII art and display them as an animation in the console.
Note: The ASCII animation may vary in appearance depending on the console or terminal used.
The script provides the following functions:
This function takes the path to an image file as input and converts the image to ASCII art.
Parameters
- filepath (str): The path to the image file to be converted. Returns
- ascii_image (str): The converted ASCII art image.
This function plays an ASCII art animation using a folder of images. It converts each image in the folder to ASCII art and displays them in sequence.
Parameters
- folder_path (str): The path to the folder containing the images.
from image_to_ascii import play_ascii_animation
if __name__ == "__main__":
folder_path = "images"
play_ascii_animation(folder_path)
In this example, the script is imported as a module, and the play_ascii_animation function is called with the path to the images folder. The script will convert the images in the folder to ASCII art and play them as an animation.
Contributions to this repository are welcome. If you find any issues or want to propose improvements, feel free to create a pull request or submit an issue.
VIRAL PUBLIC LICENSE Copyleft (ɔ) All Rights Reversed
This WORK is hereby relinquished of all associated ownership, attribution and copy rights, and redistribution or use of any kind, with or without modification, is permitted without restriction subject to the following conditions:
- Redistributions of this WORK, or ANY work that makes use of ANY of the contents of this WORK by ANY kind of copying, dependency, linkage, or ANY other possible form of DERIVATION or COMBINATION, must retain the ENTIRETY of this license.
- No further restrictions of ANY kind may be applied.