Image compression
The purpose of compression is the representation of images by methods that require less units of information (for example, bytes) than the mere storage of each pixel in arrays.
For instance, recall the binary image we constructed in the first section; that is a 128 x 128 image represented by 16,384 bits (True
/False
), where all but 113 of those bits are False
. There surely must be more efficient ways to store this information in a way that require less than 16,384 bits. We could very well do so by simply providing the size of the canvas (two bytes), the location of the center of the disk (two more bytes), and the value of its radius (another byte). We now have a new representation using only 40 bits (assuming each byte consists of 8 bits). We refer to such exact representation as a lossless compression.
Another possible way to compress an image is the process of turning a color image into its black and white representation, for example. We performed this operation on the image...