Coder Social home page Coder Social logo

ccharlieli / img2txt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hit9/img2txt

0.0 2.0 0.0 2.83 MB

Image to Ascii Text with color support, can output to html or ansi terminal.

License: BSD 3-Clause "New" or "Revised" License

Python 8.71% HTML 91.29%

img2txt's Introduction

img2txt

Image to Ascii Text, can output to html or ansi terminal.

See also gif2txt for animated version.

Example

  1. img2txt.py jiaozhu.jpg > without-color.html : demo
  2. img2txt.py jiaozhu.jpg --dither > without-color-dither.html : demo
  3. img2txt.py jiaozhu.jpg --color > with-color.html: demo
  4. img2txt.py jiaozhu.jpg --ansi: demo

Installation

$ virtualenv venv
$ . venv/bin/activate
(venv)$ pip install img2txt.py

Usage

Usage:
  img2txt.py <imgfile> [--maxLen=<n>] [--fontSize=<n>] [--color] [--ansi] [--bgcolor=<#RRGGBB>] [--targetAspect=<n>] [--antialias] [--dither]
  img2txt.py (-h | --help)

Options:
  -h --help             show this screen.
  --ansi                output an ANSI rendering of the image
  --color               output a colored HTML rendering of the image.
  --antialias           causes any resizing of the image to use antialiasing
  --dither              dither the colors to web palette. Useful when converting
                        images to ANSI (which has a limited color palette)
  --fontSize=<n>        sets font size (in pixels) when outputting HTML,
                        default: 7
  --maxLen=<n>          resize image so that larger of width or height matches
                        maxLen, default: 100px
  --bgcolor=<#RRGGBB>   if specified, is blended with transparent pixels to
                        produce the output. In ansi case, if no bgcolor set, a
                        fully transparent pixel is not drawn at all, partially
                        transparent pixels drawn as if opaque
  --targetAspect=<n>    resize image to this ratio of width to height. Default is
                        1.0 (no resize). For a typical terminal where height of a
                        character is 2x its width, you might want to try 0.5 here

Authors

  • @EdRowe (#4, #7)
  • @hit9

License

BSD.

img2txt's People

Contributors

hit9 avatar edrowe avatar

Watchers

James Cloos avatar Charlie Li 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.