By implementing the concept of tree data structure, and file handling, we take all the pixel values in the bitmap image and store it in a 2D array. Then, we find the frequency for all the pixel values in the bitmap image. that We then compress the bitmap image by using heap and the huffman algorithm to encode bytes in smaller lengths, thus making the algorithm efficient