And even though its faq is pretty comperhensive, I still think that they didn't exactly explain everything and they didn't even provide the statistics or say why exactly bzip2 is reccomended
Actually, let's start from the beggining: Why is farbfeld a good format? What does it excel at?
Well, as the faq says it's a very simple format meaning that it's easy to write programs to work with it. But there's way more. In fact it's one of the fastest and smallest lossless formats out there. Let me reiterate - farbfeld isn't just for smug coders - it's objectivelly better* and is a stand-in replacement for formats like png!
Now everything isn't so bright - the developers of many image formats tried to strike a balance between good compression and speed and they hit it right in the middle. Farbfeld can't (always) be both faster and smaller at the same time. But that's the thing - you can choose which exact variation you want to use and no matter what it will be, others can still easily view it because it's all farbfeld
And to showcase its power, I have made some...
File | Size | Compression speed | Decompression speed |
wall.ff.bz2 | 58K | 1.795s | 0.108s |
wall.ff.br | 64K | 1.373s | 0.024s |
wall.ff.xz | 66K | 0.284s | 0.022s |
wall.ff.zst (best) | 75K | 0.289s | 0.019s |
wall.ff.zst (optimal) | 77K | 0.15s | 0.016s |
wall.ff.zst (default) | 100K | 0.011s | 0.015s |
wall.ff.gz (default) | 128K | 0.062s | 0.049s |
wall.png | 151K | 0.114s | 0.02s |
wall.ff.lz4 (best) | 181K | 0.355s | 0.015s |
wall.ff.lz4 (optimal) | 183K | 0.055s | 0.015s |
wall.ff.lzo (best) | 204K | 0.24s | 0.016s |
wall.ff.gz (fastest) | 217K | 0.041s | 0.044s |
wall.ff.lz4 (default) | 231K | 0.012s | 0.015s |
wall.ff.zst (fastest) | 246K | 0.008s | 0.016s |
wall.ff.lzo (default) | 254K | 0.008s | 0.017s |
wall.ff.lz4 (fastest) | 274K | 0.012s | 0.015s |
wall.ff | 16M | 0s | 0s |
This is a rather simple image, and here most compression methods are better than png with default zst for example completely outclassing it. bzip2 is almost 3 times smaller as well
Now I wanted to call it the end of the test and think about using zstd or xz, but then I thought:
What about more complex images?
File | Size | Compression speed | Decompression speed |
painting.png | 13M | 2.9s | 0.16s |
painting.ff.bz2 | 13M | 2s | 1.4s |
painting.ff.xz (default) | 13M | 8.3s | 0.175s |
painting.ff.br (default) | 14M | 1m12s | 0.165s |
painting.ff.zst (best) | 15M | 18.6s | 0.1s |
painting.ff.zst (optimal) | 16M | 17.6s | 0.08s |
painting.ff.xz (fastest) | 17M | 0.3s | 0.09s |
painting.ff.gz (default) | 17M | 2.4s | 0.33s |
painting.ff.br (optimal) | 17M | 9.45s | 0.165s |
painting.ff.zst (default) | 21M | 0.3s | 0.09s |
painting.ff.gz (best) | 22M | 2.9s | 0.33s |
painting.ff.gz (fastest) | 25M | 0.635s | 0.37s |
painting.ff.br (optimal) | 25M | 0.3s | 0.23s |
painting.ff.lz4 (best) | 27M | 0.52s | 0.05s |
painting.ff.lzo (best) | 28M | 4s | 0.14s |
painting.ff.br (fastest) | 28M | 0.21s | 0.25s |
painting.ff.lzo (default) | 36M | 0.16s | 0.13s |
painting.ff.lz4 (default) | 40M | 0.06s | 0.05s |
painting.ff.zst (fastest) | 51M | 0.09s | 0.05s |
painting.ff.lz4 (fastest) | 52M | 0.05s | 0.05s |
painting.ff | 64M | 0s | 0s |
Now you might say: "Oh, but here png has the best compression while still keeping good decompression speeds! It must still be the best format for larger/more complex image, right?"
The authors of farbfeld reccomend to use bzip2 for its good compression ratio, but they probably haven't seen this:
painting.ff.xz (ff tuned) 8.5M 10.65s 0.16sYes, that's right: you can get a lot smaller than png while still keeping it lossless and having the same decompression speed! How cool is that?
So if you don't really care about compression speed (which I don't), this is the best option, hands down (unless you want speed and only speed, in which case use raw .ff ig)
Now for different scenarios, there are other compression formats that can be used
For example, I use raw .ff files for my wallpaper, since I access it every day and I want to save as many cpu cycles as possible and one image doesn't take up much space
The command that I used for generating the ff tuned image is as follows:
xz --delta=dist=8 --lzma2=pb=3 painting.ffAnd just in case you don't believe it, here's a benchmark of a photograph album with 101 pictures:
File | Size | Compression speed | Decompression speed |
ff.tar.xz (ff tuned) | 88M | 27.5s | 0.5s |
ff.tar.xz (best) | 97M | 1m | 1.2s |
ff.tar.bz2 | 97M | 21.3s | 10.1s |
ff.tar.xz (default) | 100M | 21.8s | 0.4s |
ff.tar.br | 104M | 10m | 0.9s |
ff.tar.zst (best) | 115M | 3m | 0.6s |
ff.tar.zst (optimal) | 118M | 2m | 0.5s |
ff.tar.xz (fastest) | 127M | 3s | 0.4s |
ff.tar.br (optimal) | 129M | 1m | 0.9s |
png.tar | 136M | 21s | 2.5s |
ff.tar.zst (default) | 151M | 5.4s | 0.5s |
ff.tar.gz (best) | 166M | 21s | 2s |
ff.tar.gz (fastest) | 186M | 4.5s | 2.2s |
ff.tar.lz4 (best) | 187M | 3.4s | 0.2s |
ff.tar.lzo (best) | 193M | 31.5s | 0.7s |
ff.tar.br (fastest) | 202M | 1.3s | 1.5s |
ff.tar.lzo (default) | 257M | 1s | 0.6s |
ff.tar.lz4 (default) | 279M | 0.2s | 0.2s |
ff.tar.zst (fastest) | 337M | 0.5s | 0.2s |
ff.tar.lz4 (fastest) | 342M | 0.1s | 0.1s |
ff.tar | 466M | 0s | 0s |
As you can see, the ff tuned xz beats its competitors out of the water at least for my use case
And yes, compressing multiple files at the same time for a better compression ratio is one of farbfeld features as well, and in case you are wondering, compressing all of them seperately is actually kind of faster, but it gives a worse compression ratio. Still better than the png's though
There are only a few applications that support this amazing format, but I'll still list the ones that I'm aware of here
So if you are developing a program, please include support for farbfeld. It would make everyone happy and we would be one step closer to getting recognised