大象传媒

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
JPEGGIFPNG
CompressionLossy DCT encodingLossless LZW encodingLossless DEFLATE encoding
AnimationNot supportedSupported (referred to as animated GIF)Not supported unless using an extended version like APNG or MNG
TransparencyNot supportedsupportedsupported
Colour depth16,777,216 colours (24bit depth)256 colours (8bit depth)16,777,216 colours (24bit depth)
Compression
JPEGLossy DCT encoding
GIFLossless LZW encoding
PNGLossless DEFLATE encoding
Animation
JPEGNot supported
GIFSupported (referred to as animated GIF)
PNGNot supported unless using an extended version like APNG or MNG
Transparency
JPEGNot supported
GIFsupported
PNGsupported
Colour depth
JPEG16,777,216 colours (24bit depth)
GIF256 colours (8bit depth)
PNG16,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.