
011000010000110
The third row contains: five 0 (whites) five 1 (blacks) five 0 (whites) This is coded as: 5,5,5 This means we get the following representation for the first three rows:1, 2, 4, 1, 4, 2, 10, 1, 5, 3, 5, 1 5, 5, 5
The key question in compression is whether or not we can represent the same image using fewer bits, but still be able to reconstruct the original image.
With a lot of images mainly photographs, there is no need to store the image exactly as it was originally, because it contains more detail than anyone can see. This can lead to considerable savings in space, especially if the details that are missing are the kind that people have trouble seeing. This kind of compression is called lossy compression. There are other situations where the images need to be stored exactly as they were in the original, for example medical scans or very high quality photographs, this is called lossless this is used if the images aren't compressed at all. JPEG removes information in the image that doesn't have as much impact on the perceived quality, with JPEG you can choose the trade-off between quality and file size. Reducing the number of bits is sufficiently crude but don't regard it as a compression method, just a low quality representation. Image methods like JPEG, GIF and PNG are designed to take advantage of the patterns in an image to get a good reduction in file size without losing more quality than necessary.