GithubHelp home page GithubHelp logo

mithuntr7 / ascii-art Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4.49 MB

A python program that takes an input image, processes it, and generates an ASCII representation of the image.

Python 100.00%

ascii-art's Introduction

ASCII Art Creator

This is a Python project that allows you to convert an image into ASCII art. The program takes an input image, processes it, and generates an ASCII representation of the image.

Dependencies

  • Python 3.x
  • PIL (Python Imaging Library)
  • Colorama (colored terminal text)

Usage

  1. Clone the repository or download the source code.
  2. Install the required dependencies (PIL library, colorama library).
  3. Place the image you want to convert into ASCII art in the same directory as the Python script.
  4. Modify the Python script to specify the image file name.
  5. Run the Python script.

Project Structure

  • ascii.py: The main Python script containing the logic to convert an image into ASCII art.
  • ascii-pineapple.jpg: Example input image (can be replaced with any image of your choice).

Feel free to explore and modify the code to experiment with different image processing algorithms, character sets, or additional functionalities.

Functionality

The project includes the following main functions:

  • get_pixel_matrix(img): Resizes the image to a height of 200 pixels while maintaining aspect ratio and returns a matrix representation of the image pixels.
  • get_brightness_matrix(pixel_matrix): Converts the rgb tuples of pixel_matrix to corresponding brightness values and returns a brightness matrix.
  • normalise_brightness_matrix(brightness_matrix): Normalizes the brightness values in the matrix to a range between 0 and 255.
  • get_ascii_matrix(brightness_matrix): Converts the normalized brightness values into ASCII characters using a predefined character set.
  • print_ascii(ascii_matrix): Prints the ASCII representation of the image.

Example

Below is an example of the ASCII art generated from the provided ascii-pineapple.jpg image:

ASCII Art

Below is an example of the same ASCII art generated using colorama library:

ASCII Art

Acknowledgments

The project is inspired by the concept of converting images into ASCII art and utilizes the Python Imaging Library (PIL) for image processing.

ascii-art's People

Contributors

mithuntr7 avatar

Watchers

 avatar

ascii-art's Issues

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.