Use this tag for questions about encoding information using fewer bits than the original representation.
Compression involves encoding information using fewer bits than the original representation.
Compression can be lossless or lossy. Lossless compression reduces bits by eliminating statistical redundancy so that no information is lost. Lossy compression reduces bits by removing unnecessary or less important information.
The process of reducing the size of a data file is often called data compression. In the context of data transmission, it is called source coding, which is encoding done at the source of the data before it is stored or transmitted. Source coding should not be confused with channel coding, for error detection and correction, or line coding, the means for mapping data onto a signal.
Compression is useful because it reduces resources required to store and transmit data. Computational resources are consumed in the compression process and, usually, in the reversal of the process (decompression). Data compression is subject to a space-time complexity trade-off. For instance, a compression scheme for video may require expensive hardware for the video to be decompressed fast enough to be viewed as it is being decompressed, and the option to decompress the video in full before watching it may be inconvenient or require additional storage. Design of data compression schemes involves trade-offs among various factors including the degree of compression, the amount of distortion introduced (if using lossy data compression), and computational resources required to compress and decompress the data.