First: how many bits in a (say) 1024 x 1024 RGB image?
Second: How much smaller can we get with lossless encoding? Well, PNG is one example.
Third: JPEG - a lossy (information is lost, depending on how blurry we are willing to allow it to be) compression algorithm, with several steps :
Both JPEG and PNG file formats also have meta data info at the front of the file in addition to the pixel data.
Note that all these are "raster" (pixel) formats - there are also "vector" formats which store math-ish info about smooth curves rather than pixels.
On to the details ...
What is "quantization" ... and how is it a (lossy) compression technique? Do an example.
Color compression :