Code Monkey home page Code Monkey logo

terminal-ascii-art's Introduction

Terminal ASCII Art

Turn images into ASCII art.

I created this in a weekend attempt to learn some Python beyond the statistical uses I'm familiar with, as one of Robert Heaton's Programming Projects for Advanced Beginners. This probably doesn't follow good practices in all sorts of ways, because I'm still learning what those are.

Usage

Capture image from a connected video source

Webcam usage requires ImageSnap ($ brew install imagesnap) and uses the first camera ($ imagesnap -l) if multiple are installed. The webcam image will be saved as snapshot.jpg.

After you clone the project:

  1. Run the requirements.txt: $ pip install -r requirements.txt
  2. Run asciiart.py: $ python asciiart.py -f 'sample.jpg'

You may need to change your font size to see the whole output, or try changing the width with -w [WIDTH].

The following options are supported:

  • -f [filename]: Path to image file to process; omit to use webcam.
  • -c: Render in 256-bit color against black background if your environment supports it
  • -m: Method for calculating pixel density. (Default='lightness')
    • 'mean': Average of pixel red, green, and blue values
    • 'lightness': Average of minimum and maximum of red, green, and blue values
    • 'luminosity': Weighted average of red, green, and blue values (0.21R + .72G + .07B) to account for human perception
  • -w [WIDTH]: Width of ASCII image before applying width scalar (see below). (Default=80)
  • -s [SCALE]: Width scalar of 1, 2, or 3 to compensate for the fact that characters are taller than they are wide. Doubles or triples each character printed to the terminal. (Default=2)

Justin Reppert

Script was written on Python 3.7.4

Distributed under the MIT license. See LICENSE for more information.

terminal-ascii-art's People

Contributors

dependabot[bot] avatar reppertj avatar

Stargazers

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