# A-level Physics (Advancing Physics)/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 = 2$^I$
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 10$^3$ as the prefix increases. Instead, we multiply by 1024. So, 1 kilobyte = 1024 bytes, 1 megabyte = 1024$^2$ bytes, 1 gigabyte = 1024$^3$ bytes, and 1 terabyte = 1024$^4$ bytes.

## Questions

1. An image transmitted down a SVGA video cable is 800 pixels wide, and 600 pixels high. How many pixels are there in the image?
2. A grayscale image is encoded using 3 bits. How many possible values can each pixel have?
3. The characters in a text document are numbered from 0 - 255. How many bits should each character be encoded with?
4. A page contains 30 lines of text, with an average of 15 characters on each line. Each character is represented by 4 bits. How many megabytes of uncompressed storage will a book consisting of 650 pages like this fill on a computer's hard disk?
5. A 10 cm wide square image is scanned into a computer. Each pixel is encoded using 3 channels (red, green and blue), and each channel can take on 256 possible values. One pixel is 0.01 mm wide. How much information does the scanned image contain? Express your answer using an appropriate unit.
Worked Solutions