A method for compression of an input image that includes a plurality of pixels
having respective input pixel values. The method includes quantizing the input
pixel values so as to generate respective quantized pixel values, and generating
a quantized image by substituting the quantized pixel values for the respective
input pixel values in the input image. The input pixel values in the input image
are reordered so as to generate a reordered image in which the input pixel values
are grouped by their respective quantized values. The quantized image and the reordered
image are compressed so as to generate a compressed output image file.