User:Inconspicuum/Physics (A Level)/Digital Storage

Digital Data
There are two different types of data: analogue and digital. Analogue data can, potentially, take on any value. Examples include a page of handwritten text, a cassette, or a painting. Digital data can only take on a set range of values. This enables it to be processed by a computer. Examples include all files stored on computers, CDs, DVDs, etc.

Pixels
Digital images are made up of pixels. A pixel represents the value of an individual square of the image, and it has a value assigned to it. The total number of pixels in an image is just like the formula for the area of a rectangle: number of pixels across multiplied by number of pixels down. When representing text, each pixel is a component of one character (for example, a letter, a number, a space, or a new line), it is not the entirety of a character. For instance if the letter 'E' was to be taken as an example and a section was to be taken through the three protrusions; a minimum of seven (7) pixels would be used, one white pixel at the top, then one black (for the first protrusion), then one white for the gap, then a black one for the centre - and so on. A type face - such as Helvetica, or Times New Roman, maybe made up of a more complex pattern of pixels to allow for serif details.

Bits
Each pixel's value is digital: it takes on a definite value. In a higher quality image, each pixel can take on a greater variety of values. Each pixel's value is encoded as a number of bits. A bit is a datum with a value of either 0 or 1. The more values a pixel can take on, the more bits must be used to represent its value. The number of values (N) that a pixel represented by I bits can take on is given by the formula:

N = 2I

Hence:

$$I = \frac{\log N}{\log 2} \approx \frac{\log N}{0.301029996}$$ Log base 10 used here. For ratios, the base of the log does not matter, now we have evaluated log 2 using base 10 log N must be base 10 as well.

A pixel may be represented by values for red, green and blue, in which case each colour channel will have to be encoded separately. When dealing with text, the number of values is equal to the number of possible characters.

Overall, for an image:

Amount of information in an image (bits) = number of pixels x bits per pixel.

Bytes
A byte is equal to 8 bits. The major difference between bytes and SI units is that when prefixes (such as kilo-, mega-, etc.) are attached, we do not multiply by 103 as the prefix increases. Instead, we multiply by 1024. So, 1 kilobyte = 1024 bytes, 1 megabyte = 10242 bytes, 1 gigabyte = 10243 bytes, and 1 terabyte = 10244 bytes.