The size of the file is the amount of memory utilized to store the document in the computer memory. Since computer memory is finite and costly, the size of the files must be very less in order for transfer and storage to be efficient. The process of decreasing file size is called compression. With the expansion of web and transfer of documents over the internet, decreasing file size has grown in importance. File compression is the process involving the substitution of data bits by strings of lesser length using special encoding schemes.
When data is sent over the internet, both the receiver and the sender must share the encoding and decoding scheme to be able to get the required output. This technique helps in better utilization of costly resources like memory and transmission bandwidth. It considerably speeds up the process of transferring the file. But it also utilizes extra processing time for compression and decompression of data.
There are two types of compression namely lossy and lossless compression techniques. Lossy compression enables high degree of compression. This however leads to a loss of some of the original data of the file. This is preferable if the receiver does not lay very much emphasis on the quality of the transmission. These are used for image transmission. Lossless transmission enables compression of data without any loss of important data. This will fail to compress certain files if it cannot find any pattern to implement compression.
The most basic method to decrease file size is removing redundant characters by replacement by a single encoded character or consecutive spaces by a new line. Some strings are substituted with a string of lesser length to aid compression. This results in decreasing file size by at least half of the original document. There are more advanced algorithms for compression which finds patterns in the file and compresses them by substituting with encoded bits.
In spite of the advantages of compressing files, it may not be applicable in some areas. In video files if the file size is decreased then the video file should be decompressed quickly enough for it to be viewed seamlessly. Data compression is effected with trade-offs for processing time and increase in hardware complexity.