What's the smallest(in size) image format which can encode xFFFFFF colors?

1.5k Views Asked by At

I'd like to know which is the image format which permits me to encode losslessly 0xFFFFFF colors, but I need the one which occupies less space on disk. I know that BMP, JPEG(variant), TIFF, PNG,(just to say some) are lossless, but which one is the one that, considering also zipping or whatever, can occupy less space?

1

There are 1 best solutions below

0
On

A PNG image (16million.png) containing all possible RGB888 colors was published in 1996. It occupies 115,989 bytes. I have converted the same image to a MNG file of just 472 bytes. The current version of pngcrush (1.8.0) brings the PNG file down to 91514 bytes. See Khalid Sayood's Lossless Compression Handbook.

If on the other hand you are asking about a format that can represent a single pixel in any one of the 16 million colors, then PNG takes 69 bytes including the 8-byte PNG signature, the IHDR, IEND, and IDAT chunk overhead, and several bytes of zlib overhead within the IDAT chunk, while a simple PPM file only takes 14 bytes to represent such single-pixel images (P6 1 1 255 \n red green blue).

Between those extremes, the best compression depends upon the content of the image.