|
-
June 10th, 2009, 01:02 PM
#1
Decoding custom image in Visual C++
Hi everyone!
I have something which I'm completely confused about it. I have 3 different image files (*.img, *.frg, *.raw). I have their respective file formats containing the header information (i.e. file name, number of images in the file, image width, image depth, etc.). Within the file format I have the bytes containing specific information. For example, my *.img file contains images with width and depth to be 512 respectively. From this information, each image file size will be 512x512x1bytes = 262,144 bytes.
My question is, how do I parse through the image bytes to draw an image in Visual C++? I can't use the Image class because it doesn't support my custom file type. I also can't use PaintLib because of the same reasons with the Image class. Im guessing the bytes for the image file will contain information for each pixel but I have no idea how to do it.
I'm fairly new at Visual C++ so please excuse me if this is a newbie question 
Thanks in advance!
-
June 10th, 2009, 01:10 PM
#2
Re: Decoding custom image in Visual C++
I guess you should look into SetDIBits function.
You said that you have 1 byte per pixel. Do you know its meaning? Is it a monochrome image? Or do you have a palette?
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
June 10th, 2009, 01:13 PM
#3
Re: Decoding custom image in Visual C++
usually the pixel data is just a sequence of bytes that follows the header, but this can be encoded in whatever way, you will have to read the format spec. for specific file formats to see how they store the pixel data, some will use palettes, compression or just store the raw pixel data.
An easy format to start with would be windows bitmap.
-
June 10th, 2009, 01:25 PM
#4
Re: Decoding custom image in Visual C++
 Originally Posted by VladimirF
I guess you should look into SetDIBits function.
You said that you have 1 byte per pixel. Do you know its meaning? Is it a monochrome image? Or do you have a palette?
according to the data format i have, my images are saved as processed images in log scale, 256 gray levels, one byte per pixel
that's all the information I have.
I've been told that i could try and use createDIBsection?
thank you all for your replies, i really appreciate it
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|