Skip to content

matekelemen/pterm

Repository files navigation

Overview

Yet another piece of code that draws images in the terminal. Now written in C!

Bonus support for animated GIFs.


"Animated" GIF in the terminal

Colored background without ASCII characters

Alpha channel support

Usage

pterm FILE [-b] [-w output_width] [-h output_height] [-t file_type]
  • FILE: path to an RGB-convertible image file

  • -b: color 'background' instead of ASCII characters

  • -w: specify output width (mutually exclusive with -h)

  • -h: specify output height (mutually exclusive with -w)

  • -t: image format; relevant if the input image is piped via stdin

Supported image formats: JPEG, PNG, TGA, BMP, PSD, GIF, HDR, PIC, PNM (see details in stb_image.h)

Header

If you wish to include pterm in your project:

#define PTERM_IMPLEMENTATION

before including pterm.h to create the implementation.

Notes

Please don't judge the code, it's just an excercise to prevent me from completely forgetting how to C.

Setup

Linux

Clone & make. Of course you can use CMakeLists.txt as well but it's just there for future Windows support.

Windows

Not supported yet; not until I figure out how to convince a Windows terminal to recognize ANSI colors.

Dependencies

None (apart from a C compiler and make/CMake). Included external sources:

About

image/gif -> ANSI+ASCII -> terminal

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages