The document describes an adaptive-quality image compression (AQIC) algorithm that aims to achieve a high compression ratio while preserving image quality. The algorithm works by identifying the most common colors and least common colors in an image. It then develops an efficient binary encoding for each color, ensuring exact retrieval of common colors and minimal approximation of uncommon colors. Experimental results showed the AQIC algorithm achieved a compression ratio of around 1.6 with a peak signal-to-noise ratio over 30 decibels, outperforming other compression methods like JPEG in terms of quality.