Coder Social home page Coder Social logo

agx-r / ascii-art-generator Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 10 KB

This Python module utilizes the Pillow library to resize and convert an image into ASCII art, displayed using a range of ASCII characters to represent different intensity levels.

License: MIT License

Python 100.00%
ascii-art ascii-art-generator ascii-graphics

ascii-art-generator's Introduction

ASCII Art Generator

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.

Features

  • 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.

Installation

  1. Make sure you have Python 3.x installed on your system.
  2. Clone or download this repository to your local machine.
  3. Open a terminal and navigate to the project directory.
  4. Install the required dependencies using the following command:
pip install -r requirements.txt

Usage

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:

Command-Line Interface

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 "@#* ."

Python Module

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")

License

This project is licensed under the MIT License.

Acknowledgements

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.

Feedback and Contributions

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!

ascii-art-generator's People

Contributors

agx-r avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.