13
2
"A picture is worth a thousand words"—so the old saying goes. The average word is about four characters long, so a picture conveys 4kB of information. But how much entropy, rather than information, can a picture convey?
Your task is to generate an image, exactly 4,000 bytes in size, with the highest entropy possible. You may use any language, libraries, or image format you choose, and you may output to the console or to a file so long as you upload your image here.
Scoring
Your score is the compression ratio (4000 ÷ compressed size) when your image is compressed with GNU tar
version 1.28 and gzip
version 1.6, using the DEFLATE algorithm and default settings — specifically, the command tar -czvf out.tar.gz image
. The smallest compression ratio wins.
1
tar
includes metadata, including mtime, in output files by default. This affects the final compressed file size - some mtimes compress better than others. Changing the command togzip -n image
would make the output size deterministic regardless of mtime (and input file name). – Nnnes – 2019-08-13T22:34:57.3371Never mind,
gzip -n image
cannot produce a file larger than 4023 bytes given a 4000-byte input. It needs 10 bytes for the header, 8 for the footer, 1 for the DEFLATE block header and padding, and 4 for the DEFLATE block size; the rest are just stored as uncompressed bytes. Most files comprised of random bits are stored uncompressed, as they should be. – Nnnes – 2019-08-13T23:40:34.123I can confirm that. Instead of compression getting worse with increasing entropy, it just flags that the data should be stored uncompressed. Deflate adds 2 bytes to the data. Gzip adds the rest. – Mark Jeronimus – 2019-08-16T21:26:08.613