Embed any binary file as a C array header. A small, dependency-free Python CLI.
bin2c <input> [-o output.h] [--name NAME] [--bytes-per-line N]
<input>: path to the binary file to embed.-o, --output: write the header to a file. If omitted, prints to stdout.--name: C identifier for the array. Defaults to the sanitized input filename stem.--bytes-per-line: number of bytes per line (default12).
python bin2c.py logo.png -o logo.h --name logo
Produces logo.h:
static const unsigned char logo[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
...
};
static const unsigned long logo_len = 1234;MIT