bmp file issues

S

steve

I am reading in a bitmap file using the microsoft bmp classes and most
all of the files are as follows

Width :640:
Height :480:
Bits :8:
Upside Down :1:
Core :0:
Palette Size :256:
Compression :0:

and are indexed images. Using fread and fseek to pull off the header
and start reading at the first pixel. When I get the indexed pixel
values and compare them to values in Photoshop they do not match. I
have read that bitmaps are "upside down". Do I need to flip things
around? I am assuming the header is 1077 bytes (0x0 through 0x436).

Thanks
 
B

Bartc

steve said:
I am reading in a bitmap file using the microsoft bmp classes and most
all of the files are as follows

Width :640:
Height :480:
Bits :8:
Upside Down :1:
Core :0:
Palette Size :256:
Compression :0:

and are indexed images. Using fread and fseek to pull off the header
and start reading at the first pixel. When I get the indexed pixel
values and compare them to values in Photoshop they do not match. I
have read that bitmaps are "upside down". Do I need to flip things
around? I am assuming the header is 1077 bytes (0x0 through 0x436).

I make that 1078 bytes: 54 header stuff and 256x4 bytes of palette data.

In what way do the values not match? Is Photoshop giving you 8-bit pixel
values, or converting these to RGB?

There is some confusion sometimes with RGB order, some parts might use BGR.

The upside down flag is to do with whether the first scan line comes first,
or last. If the latter, and you are comparing pixel (0,0), then it might
well give a mismatch, as Photoshop will likely flip the image automatically.
 
B

Barry Schwarz

I am reading in a bitmap file using the microsoft bmp classes and most
all of the files are as follows

C supports classes?
Width :640:
Height :480:
Bits :8:
Upside Down :1:
Core :0:
Palette Size :256:
Compression :0:

and are indexed images. Using fread and fseek to pull off the header
and start reading at the first pixel. When I get the indexed pixel
values and compare them to values in Photoshop they do not match. I
have read that bitmaps are "upside down". Do I need to flip things
around? I am assuming the header is 1077 bytes (0x0 through 0x436).

And your question about the C language (as opposed to your program
logic) is?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top