Farbfeld is AWESOME

And if you haven't heard of it, I reccomend you to read its faq

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...

Benchmarks!!!

FileSizeCompression speedDecompression speed
wall.ff.bz258K1.795s0.108s
wall.ff.br64K1.373s0.024s
wall.ff.xz66K0.284s0.022s
wall.ff.zst (best)75K0.289s0.019s
wall.ff.zst (optimal)77K0.15s0.016s
wall.ff.zst (default)100K0.011s0.015s
wall.ff.gz (default)128K0.062s0.049s
wall.png151K0.114s0.02s
wall.ff.lz4 (best)181K0.355s0.015s
wall.ff.lz4 (optimal)183K0.055s0.015s
wall.ff.lzo (best)204K0.24s0.016s
wall.ff.gz (fastest)217K0.041s0.044s
wall.ff.lz4 (default)231K0.012s0.015s
wall.ff.zst (fastest)246K0.008s0.016s
wall.ff.lzo (default)254K0.008s0.017s
wall.ff.lz4 (fastest)274K0.012s0.015s
wall.ff16M0s0s

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?


FileSizeCompression speedDecompression speed
painting.png13M2.9s0.16s
painting.ff.bz213M2s1.4s
painting.ff.xz (default)13M8.3s0.175s
painting.ff.br (default)14M1m12s0.165s
painting.ff.zst (best)15M18.6s0.1s
painting.ff.zst (optimal)16M17.6s0.08s
painting.ff.xz (fastest)17M0.3s0.09s
painting.ff.gz (default)17M2.4s0.33s
painting.ff.br (optimal)17M9.45s0.165s
painting.ff.zst (default)21M0.3s0.09s
painting.ff.gz (best)22M2.9s0.33s
painting.ff.gz (fastest)25M0.635s0.37s
painting.ff.br (optimal)25M0.3s0.23s
painting.ff.lz4 (best)27M0.52s0.05s
painting.ff.lzo (best)28M4s0.14s
painting.ff.br (fastest)28M0.21s0.25s
painting.ff.lzo (default)36M0.16s0.13s
painting.ff.lz4 (default)40M0.06s0.05s
painting.ff.zst (fastest)51M0.09s0.05s
painting.ff.lz4 (fastest)52M0.05s0.05s
painting.ff64M0s0s

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?"

WRONG

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.16s

Yes, 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

Howto

The command that I used for generating the ff tuned image is as follows:

xz --delta=dist=8 --lzma2=pb=3 painting.ff

And just in case you don't believe it, here's a benchmark of a photograph album with 101 pictures:

FileSizeCompression speedDecompression speed
ff.tar.xz (ff tuned)88M27.5s0.5s
ff.tar.xz (best)97M1m1.2s
ff.tar.bz297M21.3s10.1s
ff.tar.xz (default)100M21.8s0.4s
ff.tar.br104M10m0.9s
ff.tar.zst (best)115M3m0.6s
ff.tar.zst (optimal)118M2m0.5s
ff.tar.xz (fastest)127M3s0.4s
ff.tar.br (optimal)129M1m0.9s
png.tar136M21s2.5s
ff.tar.zst (default)151M5.4s0.5s
ff.tar.gz (best)166M21s2s
ff.tar.gz (fastest)186M4.5s2.2s
ff.tar.lz4 (best)187M3.4s0.2s
ff.tar.lzo (best)193M31.5s0.7s
ff.tar.br (fastest)202M1.3s1.5s
ff.tar.lzo (default)257M1s0.6s
ff.tar.lz4 (default)279M0.2s0.2s
ff.tar.zst (fastest)337M0.5s0.2s
ff.tar.lz4 (fastest)342M0.1s0.1s
ff.tar466M0s0s

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

Farbfeld's (lack of) support

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