• Stars
    star
    761
  • Rank 59,698 (Top 2 %)
  • Language
    C++
  • License
    Apache License 2.0
  • Created over 11 years ago
  • Updated over 2 years ago

Reviews

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

Repository Details

Turn images into text better than caca/aalib

hiptext Build Status

hiptext is command line tool for rendering images and videos inside terminals.

Last Supper in Macterm

Happy Cat in Macterm

Obama in Macterm

Dependencies

You need clang or gcc >=4.7. You also need to install:

sudo apt-get install build-essential libpng12-dev libjpeg-dev \
    libfreetype6-dev libavformat-dev libavcodec-dev \
    libswscale-dev libgflags-dev libgoogle-glog-dev ragel

Installation

wget https://github.com/jart/hiptext/releases/download/0.2/hiptext-0.2.tar.gz
tar xvzf hiptext-0.2.tar.gz
cd hiptext-0.2

./configure
make -j4
sudo make install

If you get compile or link errors relating to freetype, and you do not have freetype-config(1) on your path, try modifying Makefile to adjust the LIBFREETYPE_CFLAGS and LIBFREETYPE_LIBS for your system.

Usage

Images

Most image types, e.g. JPEG, PNG, GIF, etc. are supported.

hiptext balls.png

Videos

You can play videos in your terminal using hiptext. Yes, really.

youtube-dl -o gangnam-style.mp4 https://www.youtube.com/watch?v=9bZkp7q19f0
hiptext gangnam-style.mp4

Miscellaneous

hiptext --spectrum
hiptext --nocolor balls.png
hiptext --nocolor --chars=" .oO0" balls.png

Rendering Modes

xterm256

By default, hiptext assumes you're using an xterm256 compatible terminal, e.g. gnome-terminal, without bothering to check the TERMINAL environment variable.

hiptext --xterm256 balls.png

To double the number of pixels using Unicode half blocks, consider using the following option, which may become the default in the future:

hiptext --xterm256unicode balls.png

MacTerm

The most beautiful terminal for hiptext is the one built into Mac OS X called Terminal.app. This terminal uses xterm256 but it's implemented using a custom color palette that was chosen by designers rather than engineers.

But the interesting thing about this palette is that it uses slightly different colors for foreground and background. By using Unicode half blocks, this allows us to simulate something closer to 512 colors!

hiptext --macterm balls.png

However to use this, you must be using the black color scheme. After all, why would you use anything else?

Unicode

If you want to render an image without the ANSI color escape codes, you can use the --nocolor flag. This will render the image using shaded unicode block characters.

hiptext --nocolor balls.png

ASCII

The no-color mode supports a very simple character quantiser that can convert images to ASCII. Please understand that if this is what you want, there are much better tools for the job, like cacalib.

hiptext --nocolor --chars=" .oO0" balls.png

SIXEL

If you use a SIXEL terminal, e.g. mlterm >=v3.1.3, then the following flags can provide much more minute rendering:

hiptext --sixel256 balls.png           # For 256-color SIXEL terminal such as mlterm (>=v3.1.3)
hiptext --sixel16 balls.png            # For 16-color SIXEL terminal such as xterm(patch level >= #294) with "-ti vt340 option"
hiptext --sixel2 balls.png             # For monochrome SIXEL terminals

Configuration

Background

By default, hiptext assumes that your terminal background is black. If this is not the case, you can specify your background color using a CSS or X11 color string.

hiptext --bg=white balls.png

More Repositories

1

cosmopolitan

build-once run-anywhere c library
C
18,192
star
2

blink

tiniest x86-64-linux emulator
C
6,951
star
3

sectorlisp

Bootstrapping LISP in a Boot Sector
C
1,255
star
4

gosip

Public Switched Telecommunications Network Unleashed
Go
429
star
5

bestline

ANSI Standard X3.64 Teletypewriter Command Session Library
C
349
star
6

fabulous

Print images, colors, and stylish text to the terminal with Python
Python
340
star
7

disaster

Disassemble C/C++ code under cursor in Emacs
Emacs Lisp
287
star
8

landlock-make

Sandboxing for GNU Make has never been easier
C++
178
star
9

redisbayes

Naïve Bayesian Text Classifier on Redis
Python
114
star
10

occupywallst

Stomping out capitalism, one line of code at a time
JavaScript
94
star
11

pledge

OpenBSD APIs ported to Linux userspace using SECCOMP BPF and Landlock LSM
C
93
star
12

jtckdint

C23 Checked Arithmetic
C++
61
star
13

json.cpp

JSON for Classic C++
C++
31
star
14

asterisk-voicechanger

Asterisk module for adjusting pitch of voices
C
31
star
15

spandsp

C
28
star
16

tokenbucket

Atomic SWAR Token Buckets
C
27
star
17

poemy2

poemy (a poetry generator) rewritten in C++
C++
24
star
18

django-bone

Generates Django Project Skeletons Simply and Properly
JavaScript
23
star
19

swatpd

Stolen WiFi Aggregate Tunneling Protocol Dæmon (RAID your internet connections!)
C
18
star
20

zsh

Zsh patched to support Actually Portable Executables git://git.code.sf.net/p/zsh/code (upstream pending)
C
15
star
21

sofia-sip

Forked for features and packaging
C
14
star
22

blink-isystem

C++
11
star
23

includeme

Automatic C/C++ '#include' and 'using' in Emacs (WORK IN PROGRESS)
Emacs Lisp
10
star
24

justinemacs

My emacs25 text editor configuration
Emacs Lisp
9
star
25

timespan

Check if timestamp falls within specific boundaries
Python
7
star
26

js2-closure

Automatic goog.require for Closure
Emacs Lisp
5
star
27

sparkles

A decision making tool (defunct, incomplete)
JavaScript
5
star
28

web_library_example

Bootstrap Web Apps for ML Visualization
HTML
5
star
29

emacs-copilot

Large language model code completion for Emacs
Emacs Lisp
5
star
30

asterisk-parrot

Annoying robot that repeats what you say on the phone
C
4
star
31

jart.github.io

4
star
32

poemy

Poetry Generator (DEPRECATED: See poemy2)
JavaScript
4
star
33

tensorflow-makefile

C++
3
star
34

chessy

A happy toy chess engine, just for fun :) If you want a proper chess engine, check out Stockfish.
C++
3
star
35

libc-test

C
3
star
36

long-s.org

Vintage Engliſh Tranſlator
CoffeeScript
2
star
37

freeswitch

Open Source Telecommunications Platform (Unofficial Fork)
C
2
star
38

verobject

Version controlled object database on Redis
Python
1
star