Skip to content

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASCII Art Generator

ASCII Art Generator is a Python-based project that converts images to ASCII art. It uses the Python Imaging Library (PIL), numpy, and pyperclip to achieve this.

Prerequisites

Make sure you have installed the following Python libraries:

  1. Python Imaging Library (PIL)
  2. numpy
  3. pyperclip

You can install them with the following commands:

pip install pillow
pip install numpy
pip install pyperclip

Or you can install them using the requirements.txt file:

pip install -r requirements.txt

Usage

As a Library

First, import the necessary classes from the script:

from ascii_art import ImageProcessor, AsciiArt

Then, follow the example code to create instances of ImageProcessor and AsciiArt, and generate your ASCII art.

As a Command-Line Tool

You can also use the script directly from the command line. Here's how you can do it:

python ascii_art.py -i path_to_your_image.jpg -d 2

Options:

  • -i, --image: Path to the image that will be used for the ASCII art (required).
  • -d, --detail: Factor to scale the detail of the output ASCII art. Default is 1.
  • -c, --copy: Copy the ASCII art to the clipboard after generation.

Example

Here is an example of how to use the code as a library:

from ascii_art import ImageProcessor, AsciiArt

image_processor = ImageProcessor('sample.jpg', detail_size=2)
ascii_art_instance = AsciiArt(image_processor)
print(ascii_art_instance.generate_ascii_art())

License

This project is licensed under the MIT License - see the LICENSE.md file for details.


Made with ❤️ by Justin Lanfermann

About

ASCII Art Generator is a Python-based project which converts images to ASCII art. It uses the Python Imaging Library (PIL) and numpy to achieve this.

Resources

Stars

1 star

Watchers

1 watching

Forks

Used by

Contributors

Languages