What is the basic mathematical relation between compression ratio and Bits Per Pixel (bpp) of an image compression technique? How can one convert bpp to CR and vise versa.
Given bpp and the size (number of pixels- NPix) of your image the uncompressed size is Suncomp = bpp * NPix
And you have the size of the compressed image Scomp.
Now CR = Scomp/Suncomp
That's it. OK - it is wise to subtract eventual administrative information from the image sizes: these have nothing to do with the compression ratio itself and should be excluded from CR calculation.
By definition, the CR is the ratio of uncompressed data size (Suncomp) to the compressed data size (Scomp) , thus:
CR = Suncomp / Scomp
CR is a relative measure (and dimensionless) and it is many times represented as a normalized ratio (e.g. 2:1, meaning that the uncompressed size is twice the compressed size)
bpp is an absolute measure and represents the average number of bits needed to encode each image pixel information (e.g. color).
For uncompressed image bpp is typically related to the used color model and the quantization of color information. RGB images using 8 bit per channel will give bpp = 24 bit. Gray scale images have typical bpp of 8 bit (256 levels) or 12 bit (1024 levels) depending on quantization (bit depth or color depth).
For compressed images, as they are usually transformed into different representations, the bpp is evaluated indirectly by taking the following average : bpp = Scomp / NPixels.
So, as the number of pixels (NPixels) remains unchanged, compression ratio can be related with bpp, as follows: