• Stars
    star
    930
  • Rank 49,124 (Top 1.0 %)
  • Language
    HTML
  • License
    BSD 3-Clause "New...
  • Created almost 12 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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)
  • @shakib609 (#10)
  • @mattaudesse (#11)
  • @hit9

License

BSD.

More Repositories

1

gif2txt

Gif image to Ascii Text
Python
419
star
2

skylark

No longer maintained. A micro python orm for mysql and sqlite3.
Python
185
star
3

todo.c

Command line lightweight todo tool with readable storage , written in C.
C
132
star
4

bitproto

The bit level data interchange format for serializing data structures (long term maintenance).
C
131
star
5

tcptee

tcptee is a simple tcp traffic duplicator.
Go
128
star
6

oo

Simple Go Version Manager (still works).
Shell
93
star
7

htree

Package htree implements the in-memory hash tree. Hacker News: https://news.ycombinator.com/item?id=11369676
Go
92
star
8

GhResume

Another resume generator for github users. Seems still works, so many years...
CSS
65
star
9

dotfiles

❤ My ~/.dotfiles for fish/[n]vim/tmux/git/alacritty.
Vim Script
62
star
10

rux

Micro & Fast static blog generator (markdown => html).
Python
59
star
11

C-Snip

My C Snippets - buf, cfg, datetime, dict, event, heap, ketama, list, log, map, queue, skiplist, stack, strings
C
54
star
12

statsd-proxy

Fast consistent hashing proxy for etsy/statsd (no longer maintained ⚠ī¸).
C
47
star
13

oldblog

old blog of hit9.org
HTML
45
star
14

C-list

Singly linked list in C. Alternative implementation at https://github.com/hit9/C-Snip
C
40
star
15

code-snippets

My code snippets, mostly for blog https://writings.sh
C++
28
star
16

Go-patterns-with-channel

Some example patterns using channel, goroutines
Go
22
star
17

C-dict

hashtable(bkdr hash) in C. Alternative implementation checkout https://github.com/hit9/C-Snip
C
18
star
18

ntt

Node Tiny Tests module.
JavaScript
18
star
19

toml.py

Tested Toml's Python implementation.
Python
18
star
20

compile_time_regexp.h

A simple compile time dfa based regular expression library for C++20.
C++
17
star
21

sphinx-theme-rux

A no-sidebar red sexy sphinx theme
CSS
16
star
22

mdconf.py

Python implementation for visionmedia's mdconf.
Python
11
star
23

mkdwiki2

Write wiki in GitHub Flavored Markdown
Python
10
star
24

dataclass-jsonable

Simple, practical and overridable conversions between dataclasses and jsonable dictionaries (long term maintenance).
Python
9
star
25

bbuf

Dynamic bytes buffer for nodejs/iojs, a bit like the bytearray in Python.
C++
9
star
26

google.js

🙏 Search available fast google ip for blocked users.
Shell
9
star
27

ipv4.js

IPv4 utils for nodejs/iojs.
JavaScript
8
star
28

reuseport

Go reuseport for tcp/udp
Go
8
star
29

ssdb.api.docs

Unofficial SSDB API Documentation
8
star
30

skiplist

Package skiplist implements in-memory skiplist (long term maintenance).
Go
7
star
31

Simple-Pools

Simple `Thread Pool` and `Process Pool` implementation for Python
Python
7
star
32

gmls

📚 GitHub Markdown Local Server. - Read Markdown Wikis Offline
Python
7
star
33

Quadtree-hpp

Quadtree on 2d grid map in C++.
C++
7
star
34

go-ipaddress

IP address utils for golang.
Go
6
star
35

bt.cc

A lightweight C++ behavior tree library that separates data and behavior.
C++
6
star
36

rux-theme-clr

Another theme for rux with a sidebar
CSS
5
star
37

md2pdf

[ Outdated and Deprecated ] Convert single markdown file to pdf.
Python
5
star
38

Blinker.h

A lightweight signal/event library for C++, similar to Python's blinker, but designed to work with ticking loops.
C++
5
star
39

spp_lua

SSDB Protocol Parser For Lua, Built For Speed. (Included in https://github.com/eleme/lua-resty-ssdb)
C
5
star
40

node-block-queue

Nodejs in-process blocking FIFO queue implementation.
JavaScript
5
star
41

spp_node

(No more mantained) SSDB Protocol Parser For Node, Built For Speed.
C
4
star
42

Firing_squad_synchronization_problem

Firing squad synchronization problem 15-states solution in Python.
Python
4
star
43

ketama

Package ketama implements a consistent hashing ring (long term maintenance).
Go
4
star
44

bytes.js

Utf8 bytes from/to string for nodejs/iojs.
JavaScript
4
star
45

safemap

Goroutine-safe map.
Go
4
star
46

path-finding-visualizer

A small sdl program to visualize several basic common path finding algorithms.一ä¸Ēį”¨æĨå¯č§†åŒ–æœ€įŸ­čˇ¯įŽ—æŗ•įš„小åˇĨå…ˇ.
C++
4
star
47

trie

Package trie implements a in-memory trie tree (long term maintenance).
Go
3
star
48

diskstack

Package diskstack implements disk-based stack.
Go
3
star
49

onChanges.py

Watch given files and run certain command on changes.
Python
2
star
50

simple-utf8-cpp

Tiny simple library to convert between utf8 bytes and char32_t codepoints in C++
C++
2
star
51

spp_py

SSDB Protocol Parser For Python, Built For Speed.
C
2
star
52

Pdfsm.h

A simple pushdown finite states machine library in C++, separating data and behaviors as much as possible.
C++
2
star
53

flask-idempotent2

Redis based idempotent support for sqlalchemy based flask applications (no longer maintained).
Python
2
star
54

heapq.js

Heap queue implementation for nodejs/iojs.
JavaScript
2
star
55

log

Package log implements leveled logging.
Go
2
star
56

zhuanlan2pdf

zhuanlan.zhihu.com/xxx => xxx.pdf (For Offline Reading)
CSS
2
star
57

QuadtreePathfinding

2D pathfinding on quadtrees (A* and flowfield)
C++
2
star
58

TinyECS

Tiny archetype-based ECS library (C++)
C++
2
star
59

logging.js

Stream based logging module for nodejs/iojs.
JavaScript
1
star
60

flask-docjson

Validate flask request and response json schemas via docstring (no longer maintained).
Python
1
star
61

flask-sign-in-with-github.py

Sign in with github via github V3 API in Flask
Python
1
star
62

idpool

Package idpool implements a reusable integer id pool.
Go
1
star
63

promisify.js

Promisify module for node.js/io.js.
JavaScript
1
star
64

sphinx-theme-plain

A clean sphinx theme
CSS
1
star
65

rux-theme-default

github.com/hit9/rux.git default theme
CSS
1
star
66

beanstats

Little beanstalkd console tool, it will watch a single tube and show you how fast jobs are going in and out of your queue.
JavaScript
1
star
67

create-error.js

Create custom error types for nodejs/iojs.
JavaScript
1
star
68

ClearanceField

A simple incremental minimum obstacle distance field library on equal-weighted 2D grid map.
C++
1
star
69

segbitset

A failed attempt to implement a hierarchical bitset, for sparse bit data, based on segment tree.
C++
1
star