Comparison of LZMA and zlib (Image Data)
I created a BlitzMax program to filter* and compress images using either LZMA SDK or zlib. Here are the results for three test images I picked up from Wikipedia: Mona Lisa (painting), The Gunk (pixel art) and Grad1 (gradient). All compression was done with level 9 (smallest size).
Image Size (BMP) Size (zlib) Size (LZMA)
Painting 612 KB 347 KB = 56.7% 287 KB = 46.9% (17.3% better)
Pixel art 93 KB 13 KB = 13.4% 11 KB = 11.4% (15.2% better)
Gradient 63 KB 28 KB = 44.9% 23 KB = 36.3% (18.9% better)
Image Compress (zlib) Compress (LZMA)
Painting - ~160ms ~630ms
Pixel art - ~70ms ~90ms
Gradient - ~45ms ~75ms
Image Uncompress (zlib) Uncompress (LZMA)
Painting - ~40ms ~40ms
Pixel art - ~1ms ~1s
Gradient - ~3ms ~3ms
Times are not very exact for such small operations, but the results seem to suggest that LZMA compresses more and slower, but uncompresses as fast as zlib. That makes LZMA a good choice for precompressed data, while zlib may be better for real time compression.
Note: Filtering times are not included.
*The filter uses Paeth prediction similar to PNG.