True-color terminal image visualization library with command-line interface for python
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tctim
.gitignore
README.md
setup.py

README.md

True-Color Terminal Image visualization library for Python

A tool to view images or matrices directly in your (true-color supporting) terminal. Great for debugging purposes!

Install using pip

$ pip install 'git+git://github.com/chr5tphr/tctim'

Usage

Example in Python:

import numpy as np
from tctim import imprint

# make some data to visualize
grid = np.mgrid[:32, :32]
dist = ((np.array([15.5, 15.5])[:,None,None] - grid)**2).sum(axis=0)**.5

# print to console
imprint(dist)

# make some colorful data
col = np.stack([np.zeros_like(dist), dist, -dist], axis=-1)
imprint(col)

#================================
# save file to read later with CLI
from imageio import imsave

# rescale data
lo, hi = col.min(), col.max()
img = ((col - lo) * 255./(hi-lo)).clip(0., 255.).astype(np.uint8)
imsave('/tmp/someimage.png', img)

There is also a commandline-interface included:

$ tctim /tmp/someimage.png