comp.org.uk

Networking | Programming | Security | Linux | Computer Science | About

Data Compression

There are trade-offs for storing data. Image files become large very quickly. Therefore, compression techniques were developed to decrease their size. Raster or Bitmap images store data by pixel (picture element). If you had an image that was 300 × 400 pixels = 120,000 pixels, and with 3 bytes per pixel, it would take approximately 120000 * 3 = 360,000 bytes for one picture. A 10-MB pixel image would take 30,000,000 bytes, or 240,000,000 bits. Depending on the bandwidth, this image could take 30 to 60 seconds to download, which is quite slow for one image. Vector graphics have smaller file sizes than raster images.

We can reduce the amount of space needed through data compression:

JPEG (Joint Photographic Experts Group) images reduce file sizes up to 90% by replacing similar colors with the same color as large parts of the image. The replacements generally cannot be detected by the human eye.

Note that the same concepts apply for music and video files. There are lossy and lossless compression programs that can be used with these files. As with image files, the original file can be restored with the lossless technique, but not with a lossy one.

Many compression techniques assign a code to each character, including numbers and special characters. Characters that appear more frequently get a shorter code; those that appear less frequently get a longer code. The larger the file, the greater the opportunity for a larger savings on file size. For example, bitmap images are files that are usually quite large.

The format the data is stored in plays a role. The two to three-character file extension is used to determine what software tools can open and process the data.

Note too that more storage space will be needed to process files that need to be updated or “written to” versus simply read. This is because a copy of the file will be made for writing to it, in part to keep a backup copy in case it needs to be restored, as well as to handle the space needs of modifying the file. Opening files for read only access does not require this extra space.


Published on Mon 04 February 2013 by Dale Hampton in Computer Science with tag(s): compression data