These graphics are defined from combinations of mathematical shapes and curves. This allows them to be scaled up and down without loss of quality. Vector graphics are good for simple graphics & logos, but inefficient for photo-style graphics. Can be compressed using a lossless LZ-like compression.
File Formats
Bitmapped images are stored as a two-dimensional grid of pixels. "True color" images use 24 bits per pixel, 8 bits per RGB colour channel. This means that there is a simple calculation for the file size of an uncompressed image - it's basically just the volume of a box...
size in bits = (# of pixels) * (bits per pixel) = height * width * color depth
For example a 400*200 true color image:
size in kB = (400 * 200 px) * 24 bits/px * 1B/8bits * 1kB/1024B = 400*200*3/1024 kB = 234.4 kB
.bmp and .raw files are uncompressed bitmap images.
Lossless compression: Bitmap graphics can be compressed using a LZ-like compression, but it does not compress things like photos very well. Portable Network Graphics (.png) files are a lossless format.
Lossy compression:
Originally designed to be a way to connect digital instruments, but can also be used to store the sequences played/produced by a digital instrument. Midi is analogous to vector graphics and can be compressed using lossless compression.
Sound is the oscillations in the air. These waves can be captured by microphones and turned into digital data using an Analogue to Digital Converter.
Size of raw audio files (.wav, .aiff files)
For example, 2 minutes of music sampled at 16000Hz with sample depth 8 bits.
Size = (120) sec * (16000 samples/sec) * (8 bits/sample) = 120*16000*8 bits = 120*16000 B = 1875 kB
Lossless Compression
FLAC (free lossless audio codec) and other lossless compression formats use things like Run-Length-Encoding, Linear Prediction, LZ Compression etc. These achieve about a 2:1 compression ratio on music.
Lossy Compression
Codecs such as mp3 (MPEG Audio Layer III), aac (advanced audio codec), wma (windows media audio), and ogg use psychoacoustics & perceptual music shaping to reduce the quality of sounds that human listeners will not perceive. If two sounds play at the same time, often the softer one can be removed. These codecs get about a 10:1 compression ratio.
Uncompressed Video requires a very high data rate, so those formats are only used when creating and editing raw footage. For example. A "true color" 1080p video at 60fps requires: 24×1920×1080×60 = 2.98 Gbit/s = 356MiB/s. This is carried over HDMI cables, but not usually stored by consumer devices.
Real video formats are often more complicated than the "sequence of images" described above.
Video usually uses lossy compression with a range of aspects. One key aspect is only storing/transmitting the difference between frames. This is why if there is an error in the file or transmission you get ghosting effects. The main file formats you need to know about are .mpg, mp4 (Moving Picture Experts Group, details on H.264) and the older .avi (Audio Video Interleaved). MP4 gets compression ratios from 50:1 to 200:1.