Open source file compression and decompression program based on Huffman's coding.
Developed as a project for the Advanced Algorithms course at the University of the Balearic Islands.
- Works on all modern OS.
- File compression and decompression.
- Intuitive graphical user interface (GUI).
- Visualization of Huffman trees.
The compressor or encoder first reads the input file and constructs a Huffman tree based on the frequency of each byte in the file. For example, for an input file with the sentence "AABBBCD", it would create the following tree:
Then, it encodes the input tree at the start of the output file, so that it can be decompressed in the future.
Finally, it builds a map between the input file bytes and their Huffman encoding and it writes the corresponding encoded
bits into the output file. For example, the map for the input file with contents "AABBBCD" would
be: {A=10, B=0, C=110, D=111}
.
The decompressor or decoder first reads the compressed file and builds the Huffman tree from its encoded representation.
Then, it uses this tree while reading the compressed file to write the decompressed file.
The program contains an intuitive graphical user interface that allows compressing and decompressing files easily.
To compress or decompress a file, just select it on the file selector and then click on one of the two buttons located at the right menu, as shown in the next screenshot.
After having compressed or decompressed a file, it is possible to see the Huffman tree and codes. The Huffman tree can also be saved as a SVG image.