A 2d square image of resolution say 1024 x 1024 consists of a number of pixels of different colors arranged in a square pattern pattern with 1024 rows and 1024 columns with altogether 1048476 about 1 megabits (Mb) pixels.
A color picture of size 1024 x 1024 (excellent camera resolution) with about 1 megapixels requires a storage 0f 24 Mb. This will quickly consume many Gb of memory for storage, and so different techniques of image compression such as JPEG are used.
A basic method for image compression uses a Haar basis where 2 x 2 groups of pixels are are represented by Haar basis functions as illustrated in this picture:
The idea is to replace a pixel by pixel representation by a representation in terms of deviations from a mean value over each 2 x 2 group, where the mean value can be seen as a pixel representation on a twice as coarse mesh. In areas of the same color groups of fine mesh pixels can be replaced by bigger pixels thus reducing storage space.