Jules Richardson <julesrichardsonuk at yahoo.co.uk> wrote:
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.
Yeah, I discovered that out the hard way. Do all Intel CPU's do that or just x86's
(and compatibles)?
*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.
Yeah, that's exactly how it works. I assume the reserved bytes (always set to 0!) were
to do with aligning values on a 4 byte boundary for the Intel X86?
Not got onto 24-bit images yet.
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.
Ok, thanks. Will check online just to be safe :)
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.
I have some TIFF and PCX images on old PC disks (from early 90's). Microsoft Paint
doesn't support them (I don't require a proper art program on the PC for what I
do) and I doubt the vast majority of PC users have even heard of them.
I got WinCapture, made around 1993, off of one of the old disks and it still works (just
about) on Windows 2K. I can use it to capture any image onscreen (except movies read from
CD/DVD - I guess because the software is so old?) and turn it into a bitmap image :)
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
Well, like I said the main target is Amiga .iff format, but it would be nice to include
other formats for those using Amiga emulators. That way they can transfer images to a PC
friendly format for whatever purpose they require them for (website, advert, project,
etc.).
It would make advertising my games on my website easier if I can get direct images,
instead of using a webcam or digital camera to take pictures of the screen (which turn out
rubbish - see
http://www.geocities.com/aliensrcooluk/mysite/glists/my_amigagames.html )!
I haven't actually got pictures of GamesVol3 up yet, though it only contains my .ABI
encoder and decoder programs. Yes, I created my own image format!
For "simple" images it does turn out smaller than the Amiga .iff format, despite
me not using compression in version 1! I do include example images on GV3.
None of my stuff is actually available online yet, I just sent disk-based copies to 2
fellow AMOS coders - one in Germany and one in the US.
Err... I'm babbling now. Better finish up and read the rest of my emails :)
Regards,
Andrew B
aliensrcooluk at yahoo.co.uk