Giter VIP home page Giter VIP logo

img_to_ascii's Introduction

IMG_to_ASCII

A program that converts an image to ASCII art.

Requirements

  • Python 3.x
  • Pillow library (pip install pillow)
    python3 -m pip install --upgrade pip
    python3 -m pip install --upgrade Pillow

Usage

  • Run the program using python <filename>.py
  • Enter the path to the image file you want to convert.
  • The ASCII art will be saved in a file named image.txt.

How it works

  • The program takes the path to an image file as input.
  • It opens the image file using the Image module from the PIL library.
  • The image is resized to 70x70 pixels.
    It's possible to change, find line 22 image = image.resize((70, 70)) and remplace 70, 70 with the desired values. 1st value stands for width, and 2nd for height.
  • The image is then converted to greyscale using the to_greyscale function.
  • The greyscale image is then converted to ASCII art using the pixel_to_ascii function. This function maps each pixel to an ASCII character from the ASCII_CHARS string.
    • You can experiment with different characters or custom sets of characters to see how they affect the final output (line 3).
  • The ASCII art string is split into lines based on the width of the original image.
  • The ASCII art string is then saved to a file named image.txt.

img_to_ascii's People

Contributors

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