{"id":18255266,"url":"https://github.com/moontaz/huffman-code-algorithm-v1","last_synced_at":"2025-04-08T21:49:50.495Z","repository":{"id":213480108,"uuid":"734219644","full_name":"Moontaz/Huffman-Code-Algorithm-V1","owner":"Moontaz","description":"Implementation of Huffman Algorithm for encode and decode image using python","archived":false,"fork":false,"pushed_at":"2023-12-22T07:28:18.000Z","size":749,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-14T17:19:44.121Z","etag":null,"topics":["binary-search-tree","binary-tree","huffman-coding","huffman-compression-algorithm","huffman-decoder","huffman-decompression","huffman-encoder","image-compression"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Moontaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-21T06:43:41.000Z","updated_at":"2023-12-22T07:37:10.000Z","dependencies_parsed_at":"2024-12-22T12:25:54.818Z","dependency_job_id":"9ccfa177-49e5-4a63-8fc6-ffc8088d5c8a","html_url":"https://github.com/Moontaz/Huffman-Code-Algorithm-V1","commit_stats":null,"previous_names":["moontaz/huffman-encoding-v1"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moontaz%2FHuffman-Code-Algorithm-V1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moontaz%2FHuffman-Code-Algorithm-V1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moontaz%2FHuffman-Code-Algorithm-V1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moontaz%2FHuffman-Code-Algorithm-V1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Moontaz","download_url":"https://codeload.github.com/Moontaz/Huffman-Code-Algorithm-V1/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247934808,"owners_count":21020724,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary-search-tree","binary-tree","huffman-coding","huffman-compression-algorithm","huffman-decoder","huffman-decompression","huffman-encoder","image-compression"],"created_at":"2024-11-05T10:15:18.165Z","updated_at":"2025-04-08T21:49:50.469Z","avatar_url":"https://github.com/Moontaz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Huffman Encoding for Image Compression\n\nThis comprehensive GitHub repository contains a Python implementation of the Huffman Encoding algorithm for compressing and decompressing images. Huffman Encoding is a lossless data compression technique that assigns variable-length codes to input characters, providing efficient compression for data with varying symbol frequencies.\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Files in the Repository](#files-in-the-repository)\n- [Usage](#usage)\n- [Implementation Details](#implementation-details)\n- [Sample Execution](#sample-execution)\n- [Continuous Integration](#continuous-integration)\n- [Documentation](#documentation)\n- [Release Management](#release-management)\n- [How to Contribute](#how-to-contribute)\n- [Contact](#contact)\n- [License](#license)\n\n## Overview\n\nThe primary goal of this project is to showcase the application of Huffman Encoding in image compression. The repository includes Python scripts and modules that demonstrate the compression and decompression processes, along with detailed implementation of the Huffman Coding algorithm.\n\n## Files in the Repository\n\n1. **useHuffman.py**: This script serves as an example of using Huffman Encoding to compress an image. It utilizes the `HuffmanCoding` class from the `huffman_img.py` module.\n\n2. **huffman_img.py**: The module contains the implementation of the Huffman Coding algorithm for image compression. It includes a `HuffmanCoding` class with methods for compressing and decompressing images.\n\n3. **decompress_huffman_image.py**: This script provides functionality to decompress a previously compressed image using the Huffman Coding algorithm.\n\n4. **use_decompress.py**: This script demonstrates how to decompress a previously compressed image using the `decompress_huffman_image.py` module.\n5. **dataset_image1.jpg**: Sample image for testing and experimentation.\n\n## Usage\n\n### Compression\n\nTo compress an image, run the `useHuffman.py` script:\n\n```bash\npython useHuffman.py\n```\n\nThis script takes an input image (specified within the script) and generates a compressed binary file (`dataset_image1_compressed.bin`). The compressed file includes the Huffman tree structure, encoded pixel data, and metadata for decompression.\n\n### Decompression\n\nTo decompress the compressed image, run the `use_decompress.py` script:\n\n```bash\npython use_decompress.py\n```\n\nThis script reads the compressed binary file, reconstructs the Huffman tree, decodes the pixel data, and saves the decompressed image (`dataset_image1_decompressed.jpg`).\n\n### Advantages and Disadvantages\n\n#### Advantages\n1. Only need two file(image dataset, source code for compress and decompress).\n2. Output file from compression just a bin file. It's include binary code of image, pixels, python file for decompress and separated by unique code.\n\n#### Disadvantages\n1. File decompress become bigger than before, i think there are something wrong with binary tree structure for get binary code\n2. Source code is untidy\n\n## Implementation Details\n\nThe Huffman Coding algorithm is implemented in the `HuffmanCoding` class within `huffman_img.py`. Key implementation details include:\n\n- Construction of a Huffman tree based on pixel frequency.\n- Generation of variable-length codes for each pixel.\n- Compression of pixel data into a binary format.\n- Decompression using the Huffman tree and encoded binary data.\n\n## Sample Execution\n\nHere is a brief overview of a sample execution:\n\n1. **Compression:**\n   - Run `useHuffman.py`.\n   - Input: `dataset_image1.jpg`.\n   - Output: `dataset_image1_compressed.bin`.\n\n2. **Decompression:**\n   - Run `use_decompress.py`.\n   - Input: `dataset_image1_compressed.bin`.\n   - Output: `dataset_image1_decompressed.jpg`.\n\n## Continuous Integration\n\nThe repository is integrated with a continuous integration (CI) system, ensuring that changes made to the codebase are automatically tested. This helps maintain code quality and prevents regressions.\n\n### CI Pipeline\n\nThe CI pipeline consists of the following stages:\n\n1. **Linting**: Ensures code adheres to style guidelines and best practices.\n\n2. **Unit Tests**: Executes a suite of unit tests to validate the functionality of the Huffman Encoding implementation.\n\n3. **Integration Tests**: Performs integration tests to verify the interoperability of different components.\n\n4. **Code Coverage**: Measures the code coverage achieved by the tests, providing insights into the areas of the codebase that are thoroughly tested.\n\n## Documentation\n\nThe documentation is automatically generated and hosted, providing up-to-date information about the codebase. Users and contributors can refer to the documentation for detailed usage instructions, API references, and examples.\n\nThe documentation can be found at [GitHub Pages](https://moontaz.github.io/huffman-encoding-V1).\n\n## Release Management\n\nThe repository follows a versioning scheme, and releases are managed through GitHub. Each release includes release notes, summarizing changes and improvements made in that version.\n\n## How to Contribute\n\nContributions to the project are welcomed. Whether it's fixing bugs, implementing new features, or improving documentation, every contribution is valuable. Refer to the [Contribution Guidelines](CONTRIBUTING.md) for details on how to get started.\n\n## Contact\n\nFor inquiries, feedback, or collaboration opportunities, feel free to contact the project maintainer:\n\n- Maintainer Name: Muhammad Mumtaz\n- Maintainer Email: riedyriedy283@gmail.com\n\n## License  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nThis project is licensed under the [MIT License](LICENSE). By contributing to this project, you agree to abide by the terms of this license.\n\nThank you for your interest in the Huffman Encoding project. Together, let's make compression and decompression more efficient and accessible!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoontaz%2Fhuffman-code-algorithm-v1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoontaz%2Fhuffman-code-algorithm-v1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoontaz%2Fhuffman-code-algorithm-v1/lists"}