Compression (graphics)

From Higher Computing Science
Jump to: navigation, search

This article is unfinished. Please consider joining and adding to this article. Read about Page layout beforehand.

Key points

  • A graphic's size is determined by its resolution (the number of pixels in the image) and the colour depth (the number of bits used for each pixel)
  • Lossy compression can be used on graphics, sound and video files, but not text. Lossless compression can be used on any type of data, including text.
  • Lossy compression removes data from a graphic, sound or video by increasing the number of patterns in the binary code that makes up the file.
  • In a graphic, lossy compression creates colour blocks or repeating patterns in order to make a file smaller. Lossless compression can be used to identify blocks of colour in an existing image to prevent a file from storing a value for every pixel.
  • BMP files use RLE (run length encoding) to store pixels as blocks of the same colour, rather than the value of each pixel. This only reduces the file size of blocks of the same colour are present in an image.
  • GIF files use lossless LZW compression, which stores patterns in a "codebook" instead of storing each pixel.
  • JPEG files use lossy compression by changing the colour of pixels to create larger areas of the same colour, leading to better compression. The level of compression can be adjusted to suit the necessary quality of an image.
  • PNG files are lossless graphics files with support for better technologies for use online, such as streaming and interlacing. PNGs can also have transparent sections, and even semi-transparent sections.
  • TIFF files are lossless graphics files that are often used by scanners and other high-resolution imaging devices.



Further information

Test yourself

Teaching resources