Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conversion to .bmp

Status
Not open for further replies.

Bamaman

Programmer
Jun 22, 2000
3
US
I am relatively new to visual C++.&nbsp;&nbsp;I have a file of data that was transmitted in 16-bit chunks.&nbsp;&nbsp;The format is undetermined (maybe in hex).&nbsp;&nbsp;I need to convert the file to .bmp format and then display.<br><br>Any ideas or suggestions on how to do this would be greatly appreciated.
 
You must know what the format of the file is, and what it represents, otherwise how do you expect to convert it to a bitmap? Where does this file come from?<br><br>
 
The file is being transmitted from a camera flying around.&nbsp;&nbsp;The camera is taking pictures and sending the info.&nbsp;&nbsp;The format was left up to me. So any suggestions on that would be helpful too. Can it be just in lines of hexidecimal numbers?
 
I guess the easiest, but perhaps bulkiest, format would be 24-bit RGB format - 8 bits red, 8 bits green, 8 bits blue.<br><br>You mentioned 16-bit chunks - does this perhaps mean 16-bit RGB (usually 5 red, 6 green, 5 blue)?<br><br>To get that information into a bitmap, take a look at the CreateCompatibleBitmap() function to create the initial bitmap object (assuming you know the size in advance), and then the SetBitmapBits() function for filling out the bitmap object from the raw data.<br><br>Be aware though, that you will need to make sure your screen is in the 16-bit colour format for this conversion to work - if your screen is another format (different from that supplied by the camera), then you will need to fill out a BITMAPINFO structure and use one of the other CreateBitmap functions.<br><br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top