Digital photos are saved as files on memory cards and computer hard disks. They may be saved in various file formats (each format has a special file extension). The majority of the formats are compressed to save space and each has its pros and cons.
Digital photos are stored as electronic files on digital media. These digital photograph files are a collection of bytes. If each camera and manufacturer would have utilized a proprietary document format then you'll have had proprietary software that could read, print and display those formats.
A digital photograph is a group of pixels - each pixel is stored as a value that reflects its color and intensity. Usually, every pixel is represented by an RGB value (three numbers one byte each with values 0 to 255 representing the intensity of Red, Green, and Blue that blended together create the pixel's color). An RGB value occupies 3 bytes. If you want to explore more about color and intensity of digital photos search online through www.sj5000thai.com.
If you take a photograph using an 8 megapixels digital camera the photograph will have 8000000 pixels each one occupying 3 bytes. The whole file size could be 8000000*3=24000000 or 24Mbytes. This is a really big file. Big files are more difficult to control they take a while to send by email, they occupy large storage space and they take longer to load.
In any digital photo, there's data that are either redundant or if eliminated the viewer wouldn't have the ability to see the difference. Additionally representing pixels as RGB values isn't efficient in terms of storage space. The process of compression takes advantage of those details. When you compress a digital photograph the compression software reflects pixels in a more efficient manner, removes redundant data and eliminates data that's "not significant". The end result is a significantly smaller file.