bmp2asc/README.md

1.0 KiB

bmp2asc

Description

Super simple bmp bitmap to ascii converter. Wrote this in one night for funzies as kind of a proof-of-concept/ educational thing.

(There's things out there that do this better, like chafa: https://github.com/hpjansson/chafa)

It's a single cpp file with no libs used / no dependencies other than a functional c++17 compiler.

How it works

Basically, it splits the image up in a bunch of smaller character-sized images, and then for each of those, it tries to find which character matches it best, by looking at the percentage of matches in a bitmask.

The code right now assumes black is the background/alpha color, you can change that by just editing the source.

How to build it

g++ -O3 -o bmp2asc --std=c++17 bmp2asc.cpp

How to use it

bmp2asc has 2 modes, a color output mode and the regular ascii art mode. The color output mode just outputs ansi-color colored spaces.

./bmp2asc somefile.bmp ./bmp2asc -c somefile.bmp # (for color mode)

screenshot