Skip to content
Tech News
← Back to articles

Compressing a flag to 11 bits

read original more articles
Why This Matters

This story explores a novel approach to encoding country flags using minimal bits, which could lead to more efficient storage and transmission of flag images. It highlights how creative data compression techniques can make digital representations more compact, benefiting applications with bandwidth or storage constraints.

Key Takeaways

I recently saw an interesting YouTube video by “Physics for the Birds”. The main video is about matrixes, but he used flags to explain some of the operations on matrixes:

Screenshot from the video

He broke down how you could break down flags across its axes to represent them as matrixes, and save some storage space. In the end, this was used to circle back to actual matrixes and calculations on them.

However this inspired me: Flags are often so simple - just some colored stripes, common elements like a star, crescent or cross. Using some custom encoding scheme, shouldn’t defining the 🇫🇷French flag like “3 stripes, Blue, White, Red” with some custom decoder and renderer only take a handful of bits? How would such an encoding look like?

So I tried to create one:

Requirements

To start, I put down some acceptance criteria for my encoding:

The decoded flag has to be "recognizable enough”

Details don't have to be exactly correct. Small deviations, inaccuracies are ok - as long as somebody can look at it and say "Ah that's that flag!"

... continue reading