Compression
Compression is the process of reducing file size without a significant loss in quality which
results in
o Reducing the time needed to search for data.
o Faster transfer of compressed files, which uses less bandwidth than uncompressed
files.
Lossless Compression
o Type of compression that allows original data to perfectly reconstructed from
compressed file when the file is opened by utilizing some form of replacement.
o E.g. bitmap (.bmp), vector graphic (.svg) and .png images, text file compression,
database records
o Run-length Encoding (RLE)
Form of lossless compression which is used for compressing text files and
bitmap images.
Reduces file size of a sequence of elements which has adjacent, identical
elements (characters in text file and pixels in bitmap images).
Repeating sequence of elements encoded in two values: run count and run
value.
o E.g. RLE of bitmap image:
We can represent the first row as a sequence of pixels: “W B B W W B B W”
| W: white and B: black
After applying RLE: “W 2B 2W 2B W”.
In ‘2B’ 2 is the run count and B is the run value, which represents a run of
two adjacent black pixels
Process is repeated for other rows.
Lossy Compression
o Type of compression which irreversibly eliminates unnecessary data
o File accuracy/quality lower than that of lossless but file size is lower (~10% of
lossless).
o E.g. Sound files (.mp3), .jpeg images
o Sound files compression (.mp3) utilizes Perceptual Coding to remove certain parts of
sound that are less audible/discernible to human hearing.