Bitmap image formats
There are many different bitmap image formats, but only three (.gif, .jpg and .png)
are natively supported in the latest standards. Bitmap formats fall into two categories:
uncompressed and compressed, although the native formats are all compressed. We
will see why this should be so.
Uncompressed bitmaps
An uncompressed bitmap format (e.g. Windows Bitmap [.bmp]) saves each and
every pixel individually in the file. A single pixel will be anything from 1 byte
to 4 bytes typically depending on the actual format, so a bitmap 1024 pixels wide
by 768 pixels high with 3 bytes per pixel would be 1024x768x3 bytes in size (or
2.25Mbytes). Medical images and maps can be typically 4000 to 6000 pixels square,
so the file size would be enormous (48MB to 108MB).
Compressed bitmaps
A compressed bitmap format uses a data compression algorithm make the file size
smaller, in much the same way that ZIP files can hold compressed data files. Several
algorithms are used, and they can be classified into lossless and lossy algorithms.
A lossless algorithm is one which has a 100% reversible effect. I.e. when the image
is converted into pixels on the screen from the compressed file it is identical
to the original image from before compression was performed. A lossy algorithm is
one which takes advantage of the way in which humans perceive images. We find it
difficult to decipher fine detail in an image, so a lossy algorithm will make more
savings in space by removing a certain amount of fine detail before doing the actual
compression. Most lossy algorithms allow you to specify the amount of detail to
remove.
Of the three native formats, GIF and PNG files use lossless compression and JPG
files use lossy compression. They can provide image compression of typically 10%,
but anything up to 1%, of the original size of the image, although this will vary
between format, and between different subject matter in the image.