← All projects
vlangcli

image-term

A terminal image viewer written in V that renders images as colourful ASCII mosaics. It scales the image to fit your terminal, corrects for the aspect ratio of terminal characters and averages the colours within each block of pixels.

A terminal-based image viewer written in V that renders images as colored ASCII mosaics. Based on the blog post Convert an Image into Colourful Ascii Art.

image-term

How it works

image-term loads an image, resizes it to fit your terminal dimensions, and renders it using colored @ characters.

It automatically:

  • Detects terminal size and scales the image to fit
  • Corrects for a terminal character aspect ratio (characters are taller than they are wide)
  • Averages pixel colors within grid blocks for accurate color representation
  • Supports grayscale, RGB, and RGBA images via stb_image

Building

v -o image-term .

Usage

./image-term <image-path>

Supported formats

Any format supported by stb_image: JPEG, PNG, BMP, GIF, PSD, TGA, HDR, PIC, PNM.

Example

./image-term assets/54754230613_c896220d22_c.jpg

Requirements

  • V compiler
  • A terminal with true color (24-bit) support