Data Representation: Storing Images
Data Representation: Storing Images
Introduction to Image Data
- An image consists of a collection of pixels, each with their own coordinates and colour.
- Each pixel in an image is represented by a binary code, which will determine the colour and intensity of that pixel.
- The more pixels an image has, the higher the resolution – a high-resolution image conveys more visual information than low-resolution images, but at a higher data cost.
Bitmap Images
- Bitmap images, also known as raster images, are composed of pixels in a grid.
- Each pixel is represented by colour depth, the number of bits used to store colour data for each pixel. More bits provide a wider range of possible colours.
- Common bitmap image formats include .jpeg, .png, and .bmp.
- Bitmap images can lose quality when zoomed in or resized due to the fixed number of pixels.
Vector Images
- Vector images are not composed of pixels. Instead, they use mathematical formulas to draw lines and curves that make up the image.
- This means that vector images can be resized without any loss in quality, unlike bitmap images.
- Common vector image formats include .svg and .ai.
Efficiency in Storing Images
- Various methods are used to reduce the amount of data needed to store image data.
- Lossy compression reduces file size by throwing away less significant data. Once lost, this data cannot be recovered, which can cause loss of quality.
- Lossless compression reduces file size without losing data, preserving the original quality of the image. However, this method does not reduce file size as drastically as lossy compression.
- Images are also optimised by changing the image size, reducing the resolution or altering the colour depth.
File Formats and Metadata
- Different file formats use different methods of compression, resulting in variations in file size and image quality.
- Metadata about an image (such as its dimensions, colour depth, or the date it was created) is also stored in the file.
Colour Depth and Quality
- Colour depth refers to the number of bits used to represent the color of each pixel in an image. The greater the colour depth, the more colours can be represented.
- 1 bit colour depth can represent 2 different colours (usually black and white), while 24 bit colour depth can represent around 16.7 million colours.
- Increasing the colour depth results in higher quality images, but also increases file size.