## 2 Related Work  
Image compression plays a crucial role in multimedia processing and remains a significant research focus in computer science. The fundamental steps of the compression process are depicted in Figure 2. Typically, compression algorithms incorporate a preprocessing stage before the encoding process to prepare the image and optimize performance. For lossless compression, restoring the compressed file to its original state is crucial. The decompression process begins with the decoding operation, followed by a post-processing stage that reverses the preprocessing steps to reconstruct the original image [33]. In this domain, the Huffman Coding Algorithm (HCA), Run-Length Encoding (RLE) [34], arithmetic coding [35], and Lempel-Ziv (LZ) coding serve as the foundation for numerous compression techniques based on coding schemes and are widely regarded for their efficiency and adaptability [6]. Among these algorithms, the HCA [23], an entropy-based method, stands out as the most renowned due to its widespread application in various file formats. It is commonly utilized in the preprocessing stages of lossless compression algorithms. The core principle of the HCA is to assign variable-length codes to input characters based on their frequency distribution. The output of the encoding process is a code table, where symbols from the source are assigned variable-length codes according to their frequencies. Each input character is uniquely represented by a bit string determined through a Huffman tree, constructed based on the frequency table. The widespread use of the HCA across various fields and in the literature can be attributed to its simplicity, ease of implementation, and the lack of patent restrictions. Additionally, the algorithm has been adapted in numerous ways in the literature, resulting in specialized versions tailored to specific applications such as Golomb code, adaptive Huffman code, non-binary Huffman code, etc. Moreover, the HCA is utilized at the core of widely used applications today, such as MP3, JPEG, and Deflate [36]. Additionally, dictionary-based coding approaches are particularly advantageous for data with frequently repeating patterns. One of the most widely used algorithms in dictionary-based coding is the Lempel-Ziv (LZ) algorithm. Due to its applicability across various file formats, the LZ algorithm identifies frequently occurring patterns in the data and replaces them with symbols based on their frequency. As expected, this method demonstrates greater efficiency with large datasets containing repetitive patterns. Two distinct versions of the LZ algorithm, known as LZ77 [37] and LZ78 [38], have been developed, differing in their methods of pattern detection and storage. In addition, a variant called Lempel-Ziv-Welch (LZW) [39] was developed. This version allows the encoder to create an adaptive dictionary, permitting the characterization of variable-length strings without any prior information about the input. Image segmentation is a crucial preprocessing step in image compression, as it divides an image into distinct regions or segments with meaningful characteristics. This approach facilitates targeted compression by distinguishing areas of varying importance, enabling higher compression rates in less significant regions while preserving critical details in essential segments. However, a review of the literature indicates that image segmentation algorithms are primarily applied in medical imaging, where they are predominantly used to distinguish regions of interest (ROIs) from non-ROI areas. In [40; 41; 42; 43; 44] medical images were segmented into ROI and non-ROI areas, with different compression algorithms, lossless for the ROIs and lossy for the non-ROIs, applied to the respective regions. Although limited in scope, some studies have applied compression processes following image segmentation [45; 46; 47]. The literature highlights a lack of versatile and universally applicable lossless compression algorithms, as most are designed for specific domains.