TerminalImageViewer for higher-resolution terminal images
Small C++ program to display images in a (modern) terminal using RGB ANSI codes and unicode block graphics characters
At a glance
- What is it?
- TerminalImageViewer, or tiv, is a C++ image viewer that maps image regions to Unicode block characters and RGB ANSI colors. It suits users who need denser terminal rendering and can meet its ImageMagick, font, compiler, and terminal requirements.
- Who is it for?
- Adopt tiv when you want a small terminal viewer that improves image density beyond the usual half-block approach and can meet the documented ImageMagick, compiler, font, and terminal requirements. Do not adopt it for basic terminals, exact image fidelity, or environments needing a fully documented library build path without checking `src/tiv_lib.h`, `src/tiv_lib.cc`, and `LICENSE` first.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository last received commits 20 days ago.
- What is it written in?
- Mainly C++, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.
Editorial analysis
Why tiv targets modern terminal image workflows
TerminalImageViewer solves the problem of showing image data inside a terminal without opening a separate graphical viewer. It is aimed at command-line users working in scripts, demonstrations, and interactive shell sessions where the terminal is the available display surface. The program accepts one or more filenames and renders them through ANSI color sequences and Unicode block graphics characters.
The project distinguishes itself from tools such as `timg`, which use the Unicode half-block character to display two pixels per character cell. According to the README, tiv instead maps each 4x8 pixel region to a block graphics character and recalculates foreground and background colors. This increases the amount of image information represented by one terminal cell, assuming the terminal supports the required colors and glyphs.
That distinction matters when choosing a viewer. A terminal that only needs a basic thumbnail may be served by a simpler half-block renderer. tiv is more relevant when the visual density of the displayed image matters and the terminal has a suitable font and cell geometry. The documented `-0` option disables this optimization, which allows a direct comparison with the lower-density representation.
How tiv converts image regions into terminal cells
The README describes a four-step algorithm for each 4x8 pixel cell of a potentially downscaled image. First, tiv identifies which color channel, R, G, or B, has the largest range of values in the current cell. It splits that range in the middle and creates a corresponding bitmap. The program compares that bitmap with assumed bitmaps for different Unicode block graphics characters. It then recalculates the foreground and background colors for the selected character.
This mechanism changes how much image information can be represented in a terminal cell without introducing a different terminal graphics protocol. The terminal still receives characters and ANSI color values, but each character approximates a larger image region than the usual half-block method. The result is an encoding of the image, not a direct transfer of every original pixel into terminal output.
ImageMagick is the required image-processing dependency named by the README. The contribution notes also identify CImg as an image-processing library used by the program. The documentation does not specify color-management behavior, image scaling quality settings, or a pixel-perfect rendering guarantee. Those omissions matter for scientific, medical, design, or archival inspection, where an approximation may not be sufficient.
The repository also isolates reusable code in `tiv_lib.h` and `tiv_lib.cc`. The API section documents `findCharData`, allowing an application to provide pixels through a callback and receive a `CharData` result containing the selected character and colors.
Installing tiv with the documented package and source paths
The README identifies Homebrew as the documented macOS installation route. Homebrew installation is presented as part of the project's dependency model, which also requires ImageMagick. The README recommends iTerm2 because the original Apple Shell supports only 256-color mode and is described as having extra line spacing that can distort the image. That recommendation is specific to the documented macOS rendering issue.
On macOS, the documented command is:
brew install tivIf the Apple Shell produces poor results, the README gives this optional installation command:
brew install --cask iterm2For a source build, ImageMagick must also be installed. The README gives these package commands for Debian-based Linux and macOS:
sudo apt install imagemagickbrew install imagemagickThe source build uses the repository's makefile. The README states that this makefile currently supports `g++`, so this route is not documented as compiler-neutral:
git clone https://github.com/stefanhaustein/TerminalImageViewer.git
cd TerminalImageViewer/src
makeThe build produces the `tiv` binary described by the README. To place it in `PATH`, the documented optional command is:
sudo make installOn some Linux systems, the README reports that an additional linker flag may be required:
make LDLIBS=-lstdc++fsThe same section warns that this flag breaks macOS. That warning makes the source route more platform-sensitive than the documented Homebrew installation.
A first tiv command and multi-image display
The basic command takes a filename, and the README states that the shell expands wildcards before tiv receives its arguments:
tiv [options] <filename> [<filename>...]For a first use, the command form to apply is `tiv <filename>`, with an actual local image path substituted for the placeholder shown in the usage line. The repository does not provide a sample image filename, so no specific demo file can be named from the available documentation. The command should render the selected image in the terminal.
When multiple images are supplied, the README states that thumbnails and filenames are displayed by default. This behavior is useful when a wildcard expands to several image files because the user can inspect a set without opening each image separately. The README does not document a machine-readable output format, an exit-code policy, or a scripting interface for saving rendered output.
The help paths are also documented. Running the command without parameters shows the available options according to the usage description, while `--help` requests the same help information explicitly:
tivtiv --helpThe README also documents `-256`, which switches from 24-bit colors to a 256-color palette, and `-0`, which disables the higher-resolution character optimization. These options address particular rendering conditions. The documentation does not present them as guaranteed quality settings for every terminal.
Terminal, font, and image-processing failure modes
The README documents several concrete troubleshooting cases. An `unrecognized file format` error can mean that ImageMagick is not installed. Wrong colors may require `-256`, which selects a 256-color palette instead of 24-bit colors. Strange characters may indicate the need for `-0` or a font with complete Unicode coverage, with `inconsolata` and `firacode` given as examples.
Strange horizontal lines are associated with characters that do not fully fill the character cell. The project attributes this to extra line spacing in the terminal application. This is an important deployment constraint. A viewer can use the documented encoding correctly while producing a distorted image because the terminal's cell geometry differs from the assumptions made by the renderer.
The source build has a separate portability limitation. The README says the makefile supports `g++`, while manual compilation may be possible with another compiler if it supports C++17 and the required Unix headers, including `ioctl.h` and `sysexits.h`, or `windows.h`. The documentation therefore supports experimentation with other compilers, but it does not provide one portable installation procedure for every compiler and operating system.
Licensing also needs direct verification. Repository metadata lists the license as custom because GitHub cannot classify it, while the README states that the program is available under Apache License 2.0 or GPL 3.0 or later. The README also discusses bundled CImg licensing under CeCILL-CECILL 2.0 or CeCILL-C. Anyone distributing or embedding the code should inspect `LICENSE` and the included library terms directly rather than relying only on the repository label.
The tiv API and a different terminal graphics approach
The README documents an API for applications that already have a framebuffer or want to generate terminal character data from pixel callbacks. Reusable library code is isolated in `tiv_lib.h` and `tiv_lib.cc`. The documented entry point is:
CharData findCharData(GetPixelFunction get_pixel, int x0, int y0, const int &flags)The callback receives requests for pixels from a 4x8 rectangle. `x0` and `y0` identify the top-left corner. `findCharData` searches for the Unicode character and colors that best approximate that rectangle, returning the result in a `CharData` struct. This is narrower than a complete image-rendering API. The README does not document a high-level API for loading arbitrary image files, resizing complete images, managing terminal state, or handling multiple output screens.
A real alternative is a conventional terminal viewer that uses the Unicode half-block character to represent two vertical pixels per cell. Its approach is simpler because each character directly represents two pixels through foreground and background colors. tiv uses more glyph patterns to approximate a larger 4x8 region, increasing apparent density in compatible terminals while increasing dependence on font coverage and cell geometry. A user who values predictable rendering over density may prefer the simpler representation. A user who wants a denser approximation and controls the terminal environment may prefer tiv.
The README also mentions third-party packaging, including an RPM for SUSE and a Docker image linked from the project. Those distributions may simplify installation, but the core documentation still requires readers to account for ImageMagick and terminal rendering behavior.
Maintenance, upgrades, and project boundaries
The repository is not archived, and its last push was on 2026-10-03. The release history lists `v1.2.1` on 2023-12-07, `v1.2` on 2023-09-30, and `v1.1.1` on 2022-01-30. The README contains development notes dated 2024, including an API section and work toward splitting source files into dependency-free library files and a client using CImg. These facts show that repository changes have continued, but they do not establish a current release cadence.
The main upgrade cost is checking compatibility with ImageMagick, the compiler, the terminal, and the installed font. The troubleshooting notes document possible image-format errors, color differences, spacing artifacts, and missing glyphs after an installation or upgrade. The `-256` and `-0` options provide fallback paths for some conditions, but the README does not describe a configuration file, compatibility matrix, or automatic terminal capability detection.
The API is another maintenance boundary. Its documented callback operates on fixed 4x8 pixel regions, so changes to the mapping could affect downstream applications that depend on `findCharData` output. The README does not state an API compatibility policy. Before adoption, check the exact terms in `LICENSE`, inspect `src/tiv_lib.h` and `src/tiv_lib.cc`, and verify that the target terminal reproduces the expected colors and cell spacing.
Editorial conclusion
Adopt tiv when you want a small terminal viewer that improves image density beyond the usual half-block approach and can meet the documented ImageMagick, compiler, font, and terminal requirements. Do not adopt it for basic terminals, exact image fidelity, or environments needing a fully documented library build path without checking `src/tiv_lib.h`, `src/tiv_lib.cc`, and `LICENSE` first. The project is useful for interactive terminal workflows, while its character approximation and environment-dependent rendering make it a poor universal image display layer.
Frequently asked questions
What is TerminalImageViewer and who is it for?
TerminalImageViewer, or tiv, is a small C++ program for displaying images in a modern terminal with RGB ANSI codes and Unicode block graphics characters. It is aimed at command-line users who want image previews or denser terminal rendering.
How do I install TerminalImageViewer on macOS or from source?
The README documents `brew install tiv` for macOS and a source build using `git clone`, `cd TerminalImageViewer/src`, and `make`. All documented installation methods require ImageMagick, and the source makefile currently supports `g++`.
What should I do if TerminalImageViewer shows wrong colors or strange characters?
The README suggests trying `-256` for a 256-color palette, or `-0` to disable the character optimization. It also recommends checking terminal line spacing and using a font with full Unicode coverage.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/stefanhaustein-terminalimageviewer)Was this useful?