Archived

This topic is now archived and is closed to further replies.

Converting BYTE to a bitmap

This topic is 5575 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can someone tell me how to convert a BYTE to a bitmap? I need this for a program i''m working on, and the sdk i''m using saves the image in a BYTE array. But to actually use the information, I need to convert it to a bitmap (unless there is another way to do it). Thanks a lot for any help.

Share this post


Link to post
Share on other sites
meaning the sdk creates and saves to disk a byte array and then you want to read it into another program as a bitmap? or that you just want to display the byte array to screen as an image?

also what are you doing that you need to convert to bitmap? i ask not to be innane but b/c with my own program the hassle i was dealing with was writing a bitmap parser to get things INTO a byte array so i could draw them to screen easily in openGL.

to answer your conversion question, if you want it in true bitmap file format encoding, the best thing to do is get down and dirty with the format itself. it's an easy format but you'll have to be good with bitwise manipulation (>>, <<, &, |, be familiar with the meanings of big-Endian and little-Endian, etc) to be able to do the conversion and not loose your mind.

here's a link to the file format:
http://myfileformats.com/search.php?name=BMP

-me

[edited by - Palidine on September 9, 2002 1:36:39 PM]

Share this post


Link to post
Share on other sites
My SDK has a function where you pass it a BYTE array, and it save an image in it (it''s the quickcam sdk). All i want to do is display the image in my window using GDI. The only way i know how to do it is using bitmaps... but if i can directly display the BYTE, i''d like to know how to do that.

Share this post


Link to post
Share on other sites
if you only want to display image data that is stored in a byte array in GDI and have no concern for speed then why not just use the SetPixel routine with each byte triplet in your array being the RGB color of one pixel?

If you need speed, then use SetDIBits.
LoadImage is about the only GDI function that actually uses bmp files, most functions use BYTE arrays...

But if you really want to save your byte array to a 24bit bmp then look here





Runicsoft -- home of my open source Function Parser and more

Share this post


Link to post
Share on other sites