Compressing a Flag to 11 Bits
25 points by bennett_dev 3 days ago | 8 comments

kjgkjhfkjf 36 minutes ago
In case anyone else was curious about using a lookup table: there are there are fewer than 256 recognized countries or territories [1], so 8 bits should be enough for a key.

This would be superior to the 11-bit encoding presented here because it handles complexities such as coats of arms. It would also handle bizarre situations such as two countries having almost identical flags [2].

[1] https://en.wikipedia.org/wiki/List_of_countries_and_territor...

[2] https://www.worldatlas.com/articles/country-flags-that-resem...

reply
porphyra 7 minutes ago
you could also exploit the fact that some flags may appear more frequently than others and use huffman encoding or something to encode the commonly used flags in a shorter sequence than rarely-mentioned countries, and save some bits on average
reply
opiotrek 34 minutes ago
but then you have to have the svg built into decoder. will they be smaller than 5KB?

also then it's no different from a svg sprite

reply
mabster 7 minutes ago
Loved the title. I was like "that's 10 bits too many for a flag!" Haha
reply
pimlottc 27 minutes ago
Surprised this didn’t mention heraldry, which has what’s basically a DSL for coats-of-arms:

https://en.wikipedia.org/wiki/Blazon

reply
Smalltalker-80 50 minutes ago
Nobody? Okay then: "Fun with flags!". There, I said it.
reply
ano-ther 32 minutes ago
Cool idea. Interesting that Indonesia, Poland and Monaco with very similar two-stripe designs have different compression rates (11, 14 and 17 respectively). Probably the aspect ratio that also gets encoded.
reply
jtxt 40 minutes ago
Cool project and results! https://vantezzen.github.io/miniflags/
reply