You are here:

C++/Bit map file compression !

Advertisement


Question
Project Name: Bitmap Image Compression Class
Description: This project requires the implementation of hashing, link list and tree concepts and writing an application that will manipulate and compress a bitmap image and save it as a new file.
Basic Idea: As we know bitmap images data in in raw binary form and is not compressed and consumes a lot of space that is why this format is not preferred for web, in this project we want to manipulate bitmap image data and using concepts in our data structure course we want to compress that image practically using c++.  

Answer
Hi Dear arif !
  
  Of course BMP images are not recommended for web pages since for two reasons !

1. Poor Quality
2. Consumption of heavy storage space .

BMP files may vary in color depth say 8 , 16  , 24 , 32 and so on.. it mereley represents how many bits it takes up to store a pixel , wider bts allow additional properties to a pixel and of course wide color options !

Since the image is un-compressed BMP files are comparitivly larger than other image files , and so other formats say JPEG , PNG plays a good role in web pages.....!

Plenty of compression techniques available today among that simplest is run-length encoded (RLE) format for bitmaps with 8 bits per pixel. the compression format is a two-byte format consisting of a count byte followed by a byte containing a color index. ( This wold work out for 8 bit format ) and similar approach should be employed for 16
and 32 bit !

Lets take 8 bit image for our study !

The encoded mode consist of 2 bytes , the first byte specifies the number of pixels to be painted with the attribute specified in second byte the first byte  , of the pair can be set to zero to indicate an escape that denotes an end of line, end of bitmap , in detail it takes 0 for end of line 1 for end of file , the two bytes following the escape contain unsigned values indicating the horizontal and vertical offsets of the next pixel from the current position.

All these stuffs can be implemented using appropriate data structures   !

For more quries do post a follow up !

Thanks and Regards !
Prince M. Premnath  

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Prince M. Premnath

Expertise

Years of research in C/C++ Will bring you all facts regarding , OOPS , SVGA , MOUSE , BIOS , IVT , Feel free to query me :-)

Experience

More than 5 years

Education/Credentials
MCA

©2012 About.com, a part of The New York Times Company. All rights reserved.