Lossy
<aside>
💡 When a file is made smaller but some information is lost in the process
</aside>
- Used on images for websites, especially when they are a small size, as a small amount of lost information (quality) does not make much of a difference, yet speeds up the load time of the page
Lossless
<aside>
💡 When a file is made smaller but no information is lost
</aside>
Run length encoding
- When a character is repeated multiple times, it can be used in images which repeat a certain pixel colour
Huffman encoding
- Example of dictionary encoding
- Gives letters that appear more frequently shorter codes and longer codes to those that appear less often, which results in a smaller compressed file
Comparing compression
<aside>
💡 Compression ratio = uncompressed size / compressed size
</aside>