ByteZip is a tool designed to compress and decompress files efficiently. This project was created by me and my friend as part of our Data Structures and Algorithms course.
- Compression: Efficiently compresses text files using Huffman coding.
- Decompression: Restores original files from the compressed format.
- Future Support: Planned support for additional file types, including images and PDFs.
- Build a frequency dictionary.
- Create a priority queue (using a MinHeap).
- Construct the Huffman Tree by selecting the two minimum nodes and merging them.
- Assign codes to characters by traversing the tree from the root.
- Encode the input text by replacing each character with its corresponding code.
- If the overall length of the final encoded bit stream is not a multiple of 8, add padding to the text.
- Store the padding information (in 8 bits) at the start of the encoded bit stream.
- Write the result to an output binary file.
- Read the binary file.
- Extract and remove the padding information.
- Decode the bits by reading them and replacing valid Huffman code bits with their corresponding character values.
- Save the decoded data into the output file.
To use ByteZip, follow these steps:
Ensure that you have Python 3.x or later installed on your system. You can download Python from python.org.
You can clone the repository to your local machine using Git. Open a terminal (Command Prompt, PowerShell, or terminal of your choice) and run:
git clone https://github.com/yourusername/ByteZip.gitAlternatively, download the ZIP of the project from GitHub and extract it.
If you're using Python 3, tkinter (for the graphical interface) is typically included by default. If you don’t have it installed, you can install it manually:
- For Windows: Tkinter should be included by default. If not, you may need to install it via your Python installation options.
- For Mac/Linux: You can install tkinter using the following:
sudo apt-get install python3-tkOnce the setup is complete, run the application with the following command:
python ui.pyOnce ByteZip is installed and running, you can use the graphical interface to compress and decompress text files.
- Launch the application by running ui.py.
- Click the "Compress File" button.
- Select a text file (.txt) from your computer.
- The application will compress the file using Huffman coding and save the compressed file with a .bin extension.
- A success message will appear once the compression is complete.
- Launch the application by running ui.py.
- Click the "Decompress File" button.
- Select a compressed file (.bin) to decompress.
- The application will restore the original text file and save it as a .txt file with the suffix _decompressed.
- A success message will appear once the decompression is complete.
If an error occurs during the compression or decompression process, an error message will pop up to help you troubleshoot the issue.
For any questions or suggestions, please contact us at [email protected]. You can also reach out to us on GitHub at [Kiran Rajeev] and [Vijay S B].