Standard bit mapped graphic formats
JPEG, GIF and PNG are three standard file formats for bit mapped graphics.
These formats should be understood in terms of:
- compression
- animation
- transparency
- colour depth
JPEG | GIF | PNG | |
Compression | Lossy DCT encoding | Lossless LZW encoding | Lossless DEFLATE encoding |
Animation | Not supported | Supported (referred to as animated GIF) | Not supported unless using an extended version like APNG or MNG |
Transparency | Not supported | supported | supported |
Colour depth | 16,777,216 colours (24bit depth) | 256 colours (8bit depth) | 16,777,216 colours (24bit depth) |
Compression | |
JPEG | Lossy DCT encoding |
GIF | Lossless LZW encoding |
PNG | Lossless DEFLATE encoding |
Animation | |
JPEG | Not supported |
GIF | Supported (referred to as animated GIF) |
PNG | Not supported unless using an extended version like APNG or MNG |
Transparency | |
JPEG | Not supported |
GIF | supported |
PNG | supported |
Colour depth | |
JPEG | 16,777,216 colours (24bit depth) |
GIF | 256 colours (8bit depth) |
PNG | 16,777,216 colours (24bit depth) |
JPEG and PNG
JPEG and PNG support over sixteen million colours and can be used to photographs.
JPEG images use a technique called DCT encoding to split an image into 8x8 pixel blocks before removing colours that appear infrequently. This leads to the storage of less colours but is often unnoticeable to humans.
As JPEG images are compressed using lossy techniques the overall quality is not as good as that of an equivalent PNG file.
GIF
GIF files are limited in so far as the number of available colours does not allow for the storage of photographs.
GIFs are used for icons and cartoons as well as low quality images, often in animated form.
Resolution
In all cases, the resolution of an image is important. On a simple level, resolution can be defined as the total number of pixels used to create the image.
Higher resolution means better quality but greater file size.
Lower resolutions means a lower file size but poorer quality.
Colour depth
The same is true of colour depth:
- JPEG and PNG files store 24 bits for each pixel - this results in a better quality image but a greater file size.
- GIF images only store 8 bits per pixel - this results in a lower file size but a poorer quality image.