State-of-the-art lossless image compression schemes, such as JPEG-LS and CALIC, have been proposed in the context, have been proposed in the context-adaptive predictive coding framework. The essential components of the framework are prediction followed by entropy coding of the resulting residuals. In the framework, an image is encoded in a predefined order, such as, the raster scan order. It relies on the observation that the intensity value of a pixel is highly correlated with its previously encoded neighboring pixels and thus they can be used to make an effective prediction for the current pixel. The beneficial effect of prediction is that the zero-order entropy of the residual is significantly lower than that of the original image. Therefore, encoding of the residuals, instead of the original images, using entropy coding, such as Huffman codes and arithmetic codes, yields better compression in practice.Entropy coding of the residuals requires knowledge of their probability distribution. It can be observed that the distribution of residuals depends on the image's activity