## 1 Introduction
To our knowledge, the literature lacks an algorithm designed for all image characteristics that integrates image segmentation, stores the data in a specialized structure, and compresses them using a custom dynamic bit-level encoding algorithm. From a compression perspective, the limited application areas of lossless image compression techniques  
Figure 1: The representation of a digital image: (**a**) continuous—f(x,y); (**b**) digital pixel values of Baboon—f(l,j). and the relatively lower success rates of existing algorithms served as the primary motivation for developing a novel dynamic encoding algorithm. A preprocessing step was introduced to leverage the algorithm's inherent ability to perform better with similar color tones. In this step, the image was segmented based on similar color tones, and a specialized data structure was designed for efficient storage. This study presents a significant advancement in lossless image compression by introducing an innovative dynamic bit-level encoding algorithm and a framework that enhances encoding efficiency through a combination of image segmentation and dynamic bit-level encoding. The key contributions of this research can be summarized as follows:  
1. A newly developed Dynamic Encoding Algorithm (DEA) is introduced into the literature, specifically designed to enhance compression efficiency. The algorithm builds upon the well-established Huffman Coding Algorithm (HCA) while incorporating a novel adaptive encoding mechanism, making it applicable not only to images but also to various data types. Its dynamic and scalable nature positions the DEA as a promising alternative to conventional encoding techniques,
2. A novel lossless compression framework, S+DEA, is developed, which integrates image segmentation based on similar color values with the DEA. By encoding segmented image regions separately, this approach optimizes compression efficiency, achieving better performance compared to existing methods,
3. A specialized data structure is designed to store segmented image regions, preserving them lossless while enabling efficient reconstruction. Its flexibility allows for applications beyond compression, supporting various image processing applications and contributing to further advancements in the field. The proposed approach introduces a fresh perspective on lossless image compression, addressing critical gaps in the literature and significantly contributing to the field. Experimental evaluations demonstrate that the developed framework consistently outperforms existing lossless compression algorithms, confirming its robustness and adaptability across various datasets. Given its effectiveness, this study provides a strong foundation advancing lossless compression, with promising applications in both academic research and industrial settings. The structure of this paper is organized as follows: Section 2 provides a review of related work in the field. Section 3 presents a comprehensive explanation of the proposed model and its underlying methodology. Section 4 details the experimental setup and offers an analysis of the results. Finally, Section 5 concludes the study, includes a discussion of the findings, and outlines potential directions for future research.