1. A computerized method for compressing an image, the image stored as pixels in a memory of a computer, each pixel including a bit pattern indicating a gray-scale level, comprising: grouping the pixels of the image into a plurality of groups of pixels; identifying groups of pixels included in the plurality of groups of pixels having an identical bit pattern, without reference to a predefined library of bit patterns; encoding the plurality of groups of pixels into encodings according to a frequency of identified groups of pixels having identical bit patterns, wherein each encoding has an integer value; sorting the encodings according to the integer values; and encoding the difference between successive integer values.