Education project
Huffman Compressor
Compress with a tree and get the same text back
A desktop app that compresses text with Huffman coding, draws the tree with Graphviz and gives back the identical file on decompression.
What it is about
One of the Hardware Architecture projects was a data compressor. DataCompressor implements Huffman coding in Python, with a PyQt5 desktop interface and each file's tree drawn with Graphviz.
The .slo format stores the tree next to the encoded data, so the same program decompresses with no other information and the result matches the original byte for byte.
What it does
- A PyQt5 window where a .txt file is dropped to compress it, or a .slo file to decompress it.
- It counts each character's frequency, builds the Huffman tree, generates the codes and writes the result in binary with the tree inside the file.
- It draws each file's tree with Graphviz, and an installer ships the Graphviz binaries and adds them to the PATH.
- With a 3,215,616-byte text, the .slo weighs 1,712,850 bytes (53.3%) and decompresses identical to the original.
- The course repository also holds ESP32 exercises with MicroPython, Wokwi simulations and ARM assembly in QtARMSim.
Decisions and their costs
Store the tree inside the file
Without the tree there is no way to read the codes.
Compare it with 7-Zip and RAR
Huffman only shortens frequent characters, and that does not show without something to compare against.
Repositories
Every public repository of the project, with what it holds.
- 2024Python, MicroPython, ARM Assembly, ESP32
ARQHEngineeringSebastian-s
Hardware architecture, with a Huffman compressor, ARM assembly in QtARMSim and an ESP32 in Wokwi with MicroPython and a Telegram bot.
Stack
Pick a technology to see the projects that use it.







