Search code examples
algorithmimage-processingimage-compression

Considering image compression, is Run length encoding always better than Huffman coding?


We found out that run length is much better than huffman coding (JAVA) considering compression ratio. Is it true for all cases?


Solution

  • Of course not. Consider ABABABAB, it will compress better with huffman than run-length encoding.

    Run length will only work for data that have repeated values; that's not guaranteed in images.