Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

Calculating storage requirements

Data is store in bits and the following units are used

8 bits 1 byte or 1B
1024 bytes 1 kilobyte (1kb)
1024 kilobytes 1 megabyte (1MB) or 1048 576 bytes
1024 megabytes 1 gigabyte (1GB) or 1 073 741 824 bytes
1024 gigabytes 1 terabyte (1TB) or 1 099 511 627 776 bytes

To convert bits to bytes you divide by 8 and to convert bytes to kilobytes


you divide by 1024. Successive division by 1024 changes the units to
the next level.
Storing data

Data to be stored Storage requirements


Pixels in a black and white image 1 bit per pixel
Pixel in an 8-bit colour image 8 bits (1 byte) per pixel
Characters in an ASCII test string 1 byte (8bits) per character
Sound in a wave file 86 kilobytes per second
Uncompressed frame of standard-definition TV 27 megabytes per frame
Uncompressed frame of high-definition TV 182 megabytes per frame
Example 2 – Storing a simple B/W image

A back and white picture is stored as follows

The has 8 rows and 8 columns which gives us 64 pixels (8 X 8)


64 pixels X 1 bit per pixel = 64 bits
64 bits / 8 = 8 bytes
Example 3 – Storing an 8 bit colour image

A colour image is stored as follows

Since the image now has 8 bit colour, its needs 8 bits (1 byte to store the colour)
64 pixels X 8 bits = 512 bits
512 bits / 8 = 64 bytes
Example 4 – calculating file size from image
size and resolution.

A 24-bit colour image that is 2cm high X 3cm wide, with a


resolution of 300 dots per inch is to be stored.
To calculate the number of pixels we use the resolution of 300
dot per cm and the image dimension 0f 2 X 3, so its 600 pixels
(2 x 300) by 900 pixels (3 x 300) since it’s a 24-bit colour
image it would require 24 bit for each pixel excluding meta-
data 300 pixel x 900 pixels =270 000pixels
270 000pixels x 24 bits per pixel = 6 480 000 bits
6 480 000 bits / 8 810 000 bytes
810 000 bytes / 1024 791.02 kilobytes
791.02 kilobytes / 1024 0.77 megabytes
Activity 6.2
Activity 6.2
a. An image is 1200 pixels by 1600 pixels. Calculate:
i. the total number of pixels in the original image
ii. the number of bytes occupied by this file
iii. the file size of the jpeg image (in kilobytes) if the original
image was reduced by a factor of 8.
Activity 6.2
b. A second image is 3072 pixels by 2304 pixels. Calculate:
i the total number of pixels in the original image
ii the number of bytes occupied by this file
iii the file size of the jpeg image (in megabytes) if the original
image was reduced by a factor of 5.
iv How many uncompressed files of the size calculated in part
(ii) could be stored on a 4-gigabyte memory card?
v How many compressed files of the size calculated in part (iii)
could be stored on the same 4-gigabyte memory card?
Text and number file formats

Text and numbers can be stored in a number of formats. Text is


usually stored in an ASCII format When using spreadsheets or
databases, for example, numbers can be stored in a number of
different formats:
real e.g. 2.71678
integer e.g. 3
date e.g. 12/08/2016
time e.g. 19:45:50
currency e.g. R$ 15.50
PIXELS

• The more pixels a picture has, the higher resolution it has


which means it is more clearer. 
• An image which is 2048 pixels wide and 1536 pixels high is
equal to 345,728 pixels. (2048*1536) . To convert pixels to
bytes you multiply by 3 for example 3072 * 2304 = 7,077,888
pixels,  7,077,888 * 3 = 21,233,664 bytes.
• A raw bitmap can often be referred to TIFF or BMP image,
the size of the image is determined by the number of pixels.
HOW TO CALCULATE IMAGE SIZES

• Number of pixels : horizontal pixels * vertical pixels


• Size of the image files: number of pixels * 3 (colours -Red, Green, Blue)
• File size when reduced: image size / reduction factor
• Size of the image file from bytes to kilobytes: image size in bytes / 1024
• Size of the image file from kilobytes to bytes: image size in kilobytes * 1024
• Number of files in a storage device: storage device capacity / file size (both have
to be the same memory size and round down to thee nearest whole number)
Example 5 – calculating file size of an audio
file

To calculate the size of an audio file, 5 pieces of information


are needed
• Length of the audio ( in seconds)
• Number of samples taken per second (sample rate)
• Number of bits used to store each sample (sample depth)
• Number of channels used to play the track (mono = 1 & stereo = 2)
So its Sample rate x sample depth x track length x number of tracks
Example 5 – calculating file size of an audio
file

An audio track is 3 minutes 30 seconds seconds in total ) in


length, recorded in stereo, samples at 44Khz (44000Hz) with a
sample depth of 16 bits.
Calculation
44000 x 16 x 210 x 2 =295 680 000 bits
295 680 000 bits / 8 = 36 960 000 bytes
36 960 000 bytes / 1024 = 36093.75 kilobytes
36093.75 kilobytes / 1024 = 35.25 megabytes
Activity 6.1
A CD is being used to store music. Each minute’s worth of
recording takes up 12 megabytes.
a. The CD contains nine tracks which are the following length
(in minutes): 3, 5, 6, 4, 5, 2, 7, 8, 8. How much memory
would these nine tracks occupy on the CD?
b. If the CD was downloaded to a computer and then all the
tracks were put through an MP3 compression algorithm,
how much memory would the nine tracks now occupy (you
may assume a 90 per cent file reduction size)?
Activity 6.1
a. Find the average size of each of the MP3 tracks, and then
estimate how many MP3 files could be stored on an 800
megabyte CD.
Activity 6.2
An image is scanned with an image resolution of 1024 × 512
pixels, and a colour depth of 8 bits per pixel.

Calculate the file size, giving your answer in mebibytes. Show


your working.

You might also like