2. Image Compression
Common compression techniques are:
•RLE
•LZW
•CLUT
The most common image compression file formats are:
•GIF
•TIFF
•JPEG
•PNG
Bitmaps (BMP) are generally uncompressed image files
3. RLE
Run Length Encoding
Where a bitmapped image has pixels of the same colour, only need to
store the colour code for 1 pixel and how many times it repeats.
4. RLE
Using RLE the image below could be stored as follows, using less data
#DAEEF3 #B6DDE8 #92CDDC #31849B (7) #DAEEF3 (2)
#DAEEF3 #B6DDE8 (3) #31849B (8)
#C6D9F1 #8DB3E2 #E5B8B7 (6) #943634 (2) #E5B8B7 (2)
#D99594 (5) #D99594 (7)
#E5B8B7 (2) #943634 (7) #E5B8B7 (3)
5. RLE
Using RLE the image below could be stored as follows, using less data
#DAEEF3 #B6DDE8 #92CDDC #31849B (7) #DAEEF3 (2)
#DAEEF3 #B6DDE8 (3) #31849B (8)
#C6D9F1 #8DB3E2 #E5B8B7 (6) #943634 (2) #E5B8B7 (2)
#D99594 (5) #D99594 (7)
#E5B8B7 (2) #943634 (7) #E5B8B7 (3)
Each pixel is 24 bits (3 bytes). On the first line, for the run of 7 pixels of
colour #31849B we don’t have to store 21 bytes, just 3 bytes for the
colour and another 2 bytes for the number of pixels ie 7.
6. LZW
• Compression technique named after its creators: Abraham Lempel,
Jacob Ziv, and Terry Welch
• Used with GIF, TIFF and bitmap file formats
• Sequences of bits (e.g. 12) are stored in a table. If the same
sequence occurs again, just use the index to the table and not the
actual sequence.
• Works best with images made up of solid colours as opposed do
gradients
• LZW compression averages around 30-40% file size reduction
7. CLUT
• Colour Look Up Table
• Use a palette of colours
• Example – an 8 bit palette would give 256 different colours for use in
the image which could be chosen from the full 24 bit true colour range
(16.7 million colours).
Using the CLUT would reduce the storage requirements to 33% (one
byte per pixel instead of 3)