Compression - the process of compacting an image by removing redundant information.
If I take a photo for the mugshot board, it's probably just a head and shoulders against a white background. For that white background, it's a waste of filespace to hold 8 or 24 bits of information for each pixel, all with the value for white. It would be much more efficient to say that the next 285 pixels (or whatever) are all white.
There are two main types of compression:
Lossless compression - on decompression, the original is restored in every detail.
Lossy compression - unnecessary(?) detail is thrown away
Compression
Uncompressed
Consider a row of pixels, some of colour 5 and some of colour 6
| 5 | 5 | 5 | 6 | 5 | 5 | 6 | 6 | 6 | 6 | 5 | 5 | 5 | 5 |
Lossless compression
For lossless compression I could say I have 3 pixels of colour 5 and then 1 of colour 6 and then
2 of colour 5 etc
5(3),6,5(2),6(4),5(4)
This could be expanded back to what we started with.
Lossy compression
To compress the image further, I could say that colour 6 is very nearly the same as colour 5, so
why don't we just say we have 14 pixels of colour 5
5(14)
Information is then lost and this could not be expanded back to what we started with.
tiff is an uncompressed format
gifs use lossless compression
jpgs use lossy compression
