gdaladdo [-r {nearest,average,average_mp,average_magphase,mode}] filename levels
The gdaladdo utility can be used to build or rebuild overview images for most supported file formats with one over several downsampling algorithms.
Mode is not actually implemented, and average_mp is unsuitable for use. Average_magphase averages complex data in mag/phase space. Nearest and average are applicable to normal image data. Nearest applies a nearest neighbour (simple sampling) resampler, while average computes the average of all non-NODATA contributing pixels.
Selecting a level value like 2 causes an overview level that is 1/2 the resolution (in each dimension) of the base layer to be computed. If the file has existing overview levels at a level selected, those levels will be recomputed and rewritten in place.
Some format drivers do not support overviews at all. Many format drivers store overviews in a secondary file with the extension .ovr. The GeoTIFF driver stores overviews internally to the file operated on. That file may be compressed. It is controlled via the COMPRESS_OVERVIEW system option. All compression methods, supported by the GeoTIFF driver, available here.
Example:
Create overviews, embedded in the supplied TIFF file:
gdaladdo -r average abc.tif 2 4 8 16
Create an external compressed GeoTIFF overview file from the ERDAS .IMG file:
gdaladdo --config COMPRESS_OVERVIEW DEFLATE erdas.img 2 4 8 16