chb
Finally, the solution to the problem everyone has: how to display high quality images over text mode connections like ssh!
libchb is a library that converts images to a half block unicode representation with ANSI coloring: Colored Half Blocks. It supports color bit depths of: 3, 4, 8, and 24.
Download
A beta version of the API and implementation is available: libchb.0.9.tar.gz. The library itself has no build dependencies other than standard C99, but does need a terminal that support ANSI escape codes and Unicode to work correctly. The viewer needs ImageMagick in Linux, GDI+ in Windows, and Cacoa on MacOS. Use CMake to build and check out thetest_image.c
for example usage.
Beta API reference
This is an early interface- minor changes should be expected as the library approaches 1.0. Seechb.h
and test_image.h
for details and use.
Print an image with best guesses for all parameters.
void chb_print_image(unsigned int width, unsigned int height, unsigned char const * rgb_image);Print an image, supplying parameters to configure depth and output character options.
void chb_print_image_opt(unsigned int CHB_DEPTH, unsigned int CHB_CHAR, unsigned int width, unsigned int height, unsigned char const * rgb_image);Prepare and free a frame state object for use in tracking frame data over time.
void chb_init_frame(unsigned int width, unsigned int height, chb_frame_state* state); void chb_free_frame(chb_frame_state * state);Print a single frame of a multiframe sequence, supplying parameters to configure depth and output character options.
void chb_print_frame(chb_frame_state * state, unsigned int width, unsigned int height, unsigned char const * rgb_image);Print a single frame of a multiframe sequence, supplying parameters to configure depth, output character, palette, and frame replace options.
void chb_print_frame_opt(chb_frame_state * state, unsigned int CHB_DEPTH, unsigned int CHB_CHAR, unsigned int CHB_PALETTE, unsigned int CHB_REPLACE, unsigned int width, unsigned int height, unsigned char const * rgb_image);