> [Sparkle]
1701> bmptoppm < keyboard1.bmp > keyboard1.ppm
> bmptoppm: warning: offBits is 54, expected 67108918
54 looks fine - offbits is
the byte offset after the file header
where the image data begins. [...]
An expected offset over 60MB in size seems extremely wrong :)
67108918 is 0x4000036, while 54 is 0x36; I assumed, absent
documentation, that the low three bytes are the offset and the high
byte is some kind of flags, which is getting rolled into the same
variable by the code.
> I managed to view them fine with xv under solaris,
is there a
> problem with bmptoppm ?
Yes, there obviously is something wrong with bmptoppm; even if it can't
work, it shouldn't actually core.
However, it's the only bmp-reading tool I have, and I have no
documentation on BMP format to either fix it or write another.
I may see if I can deduce enough from the code to fix it; this
discussion has gotten me curious.
Run hexdump -C on the file:
Bytes 0 and 1 should have the ascii characters
'BM'.
Check.
Bytes 2,3,4,5 give the size in 4 byte units of the
file.
Mismatch. Bytes 2,3,4,5 give the size in bytes (little-endian; you
didn't specify which byte sex).
Bytes 6,7,8,9 are reserved - I've only ever seen
these set to zero.
Check. The bmptoppm code implies these are a hot-spot location.
Bytes 10,11,12,13 give the offbits value, least
significant byte
first. It's found 54, so is obviously reading that correctly.
"36 00 00 00" - yes.
Bytes 14,15,16,17 are within the image header itself
and give the
size of the image header - 12 bytes for an OS/2 bmp file, 40 bytes
for a Windows bmp, and no expected other values.
"28 00 00 00" - that's 40.
I haven't got a copy of the zipfile that Lyos sent
to try otherwise
I'd take a look...
I still have it. Shall we take this offlist?
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse(a)rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B