Andrew Burton wrote:
Hi, i was reading up on bitmap (mainly .bmp, with some
.wbmp) images
last night and was wondering why everything is stored backwards
(e.g. BGR instead of RGB and the bottom of the image first, instead
of the top)?
I believe the backwards RGB quads* are just a hang-up from the fact that
almost every platform which supported .bmp files used an Intel x86 (or
compatible) CPU - and Intel's x86 processors store multi-byte values lowest-first.
*Going from hazy memory, I seem to recall that colour map entries in .bmp
files are four bytes: BGRx, with x being always set to zero. I can't remember
if 24-bit direct-colour images also use four bytes per pixel or only three.
No idea why the origin of the image was bottom-left rather than top-left, but
there wasn't ever really a standard for this kind of thing (if MS Windows
itself sets the origin at bottom-left then it certainly makes sense; .bmp was
really only ever popular for MS-Windows, after all)
Also would i need to pay a license if i wrote a
program to create .bmp
files?
As far as I know, no.
My main aim is to write a .bmp to (amiga) .iff format
Heh, the last time I wrote any .bmp handling code it was to do that the other
way around, as I had a bunch of IFF files that I wanted to read on a Windows
3.1 box.
, but would love to add
full .bmp support to an art program i wrote for the
amiga and then stick it
online (on
Aminet.com ) for other people to use if they wish.
Obvious question: why .bmp? As above, it was only ever popular with MS
Windows; in the rest of the world TIFF, PCX, or Targa support tended to be a
lot more prominent. PCX and Targa seem to have fallen by the wayside these
days, but TIFF is still alive and well, and of course PNG has come on the scene.
If I were writing something to export data to an image format these days, I'd
pick TIFF or PNG over MS-bitmap; certainly writing a TIFF encoder isn't too
complex (writing a comprehensive decoder can get a little hairy due to all the
vendor extensions, but writing something to handle the typical flavours isn't
hard), and from what I hear PNG isn't too difficult to handle either.
cheers
Jules