## 5 Discussion and Conclusions  
The increasing size of image data in today's world poses significant challenges and costs in terms of transmission and storage. As a result, image compression has become one of the most frequently studied and widely researched topics in the literature, attracting considerable interest of researchers. This study addressed these challenges and provided notable contributions to the field, which are summarized as follows:  
1. DEA: The proposed algorithm presents an innovative method for dynamically optimizing bit lengths based on character succession frequencies. This method achieved better compression ratios. 2. S+DEA: The dual-phase framework, combining segmentation as a preprocessing step with the DEA, led to notable improvements in compression efficiency. 3. General-purpose specialized data structure: A specialized data structure was developed to store segmented image parts without data loss. Its applicability extends beyond image compression to various data-processing scenarios. These methodologies were validated on various datasets, including medical, satellite, and agricultural images, demonstrating their versatility, robustness, and reliability. The algorithms and approaches were evaluated and compared using the CR, BPP, SS, and IP metrics, utilizing datasets and images with varied color tones and characteristics. The evaluation of the results demonstrated that the DEA consistently achieved significantly higher performance compared to the defined reference algorithms across all images. When the segmentation preprocessing step was included, the S+DEA demonstrated a slight but noticeable improvement in performance. Notably, the S+DEA demonstrated strong performance across various datasets, excelling particularly in smaller datasets, while maintaining competitive efficiency in larger datasets with high-resolution images. Although this contribution may appear modest, its effectiveness becomes more evident when considering the resolutions and sizes of images in datasets such as satellite imagery or medical image collections. Overall, the S+DEA achieved significantly high performance, validating its relevance and adaptability in various applications. When the benchmarking algorithms were evaluated, it was observed that while the proposed method generally performed well against comparison algorithms, its performance in the medical image dataset was slightly lower than that of the JPEG-LS algorithm. This is primarily due to the encoding methods used by JPEG-LS and JPEG2000, which predict pixel values based on their neighboring pixels. This approach is particularly well suited for capturing the subtle grayscale variations present in medical images. Therefore, to ensure that the S+DEA algorithm surpasses JPEG-LS across all image types, future research will explore alternative preprocessing techniques, such as wavelet-based preprocessing, regional contrast enhancement, or principal component analysis (PCA), specifically tailored for datasets where segmentation proves ineffective. Additionally, for medical images, the application of the DEA in combination with region-of-interest (ROI)-based segmentation, which is considered a gold-standard approach, will be evaluated to further enhance compression efficiency. Moreover, given the need for real-time compression and transmission, the processes of image segmentation and subsequent packaging of segments may introduce limited delays. Due to the relatively modest contribution of the segmentation step, it is recommended to use the DEA alone for real-time applications. Conversely, for applications prioritizing archival and storage over real-time processing, the use of the S+DEA is advised, given its higher compression performance. These findings have the potential to establish a new benchmark in data compression, both in theory and practice, while also serving as a strong foundation for future research.