Skip to content

Comment on Show HN: Embed your source code in PNG files

Comments

What about the opposite, embedding PNG files into source code?

xxd can out put any random set of bytes as C code.

For example:

    > xxd -i tmp.f

    unsigned char tmp_f[] = {
        0x38, 0x4a, 0x39, 0x6f, 0x61
    };
    unsigned int tmp_f_len = 5;
I use it as part of a number of build scripts.

Well, isn't it the binary representation of the PNG already?

Well, that's not exactly novel[1], though it can be handy.

1: https://png-pixel.com/

IIRC, HolyC from TempleOS could embed arbitrary files into a source file.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.