Graphic Formats
JPEG (.jpg) Lossy compression
- 24 bit colour.
- Allows the user to select an appropriate level of compression.
- JPEG is a good compression format for high-quality images and images where quality is unimportant (e.g. thumbnails).
PNG (.png) Lossless compression
- Intended to improve upon GIF format.
- 24 bit colour.
- Allows user to set alpha level for improved transparency.
GIF (.gif) Lossless compression • Restricted to 8 bit colour.
- Several images can be stored in one GIF file, allowing for animation.
- Allows a specific colour in an image to be made transparent.
- GIF is a good compression format for images with areas of flat colour, images that have few colours, animated images or images that require transparency.
Graphic file size calculations
To calculate the file size (in bits) of a bitmap graphic file the basic formula is:
number of pixels in image x bit depth
- Bit depth or colour depth is the number of bits that were used to store the colour of each pixel.
- 8 bit – 256 colours
- 16 bit – 65536 colours (High Colour)
- 24 bit – 16777216 colours (True Colour)
- DPI (dots per inch) the number of pixels in a physical inch of paper.
Example 1
Calculate the file size of a 400 x 400 pixel graphic with a colour depth of 24.
400 x 400 = 160000 pixels in the image
160000 x 24 = 3840000 bits
3840000 / 8 = 480000 bytes
480000 / 1024 = 468.75 KB
Example 2
Calculate the file size of a 300 x 200 graphic with 256 colours.
256 colours means a colour depth of 8 (because 2^8 = 256)
300 x 200 = 60000 pixels in the image
60000 x 8 = 480000 bits
480000 / 8 = 60000 bytes
60000 / 1024 = 58.6 KB
Example 3
Calculate the file size of a 6’ x 5’ image, scanned at 200dpi, with 16 bit colour.
6 x 5 x 200 x 200 = 1200000 pixels in image
1200000 x 16 = 19200000 bits
19200000 / 8 = 2400000 bytes
2400000 / 1024 = 2343.75 KB
2343.75 / 1024 = 2.3 MB