Solved it!

2004-05-14 08:01:13 PM
Sorry! Solved it..
I must have been tired last night.. spotted it now.
There was a..ehem.. error in my code that broke with compression.
Jon Lennart Aasenden
"Jon Lennart Aasenden" <XXXX@XXXXX.COM>writes
Hello again (and again..).

Ok, perhaps someone here can clear this up for me.

I have added support for 15 and 16bpp to my graphics library (no API calls
used, everything is native delphi).

15Bit is ofcourse defined as 555 (r=5bits..etc), while 16bit is defined as

While this works perfectly with the displaying of graphics (as it should),
im having a hard time coding a bitmap loader that distinguish between

Turns out that photoshop saves it is 16bit images in 555 mode, and 15bit
images in 565 mode! The exact opposite of how the data is represented in

Also, the 15bit modes have a different value in the bitmapinfo header.
All bitmaps have the value 80 in the InfoHeader.biSize property, but 15bit
images (saved with photoshop) have the value 56.

Is this an indication value that 565 encoding is used? Is it supported
officially? Is there any documentation online about loading bitmaps
directly? I have been at this problem now for 2 days! 2 days!

Also, the BitmapFileHeader.bfOffBits does not match up to the offset value
get after parsing the file. It is correct, but there seems to be
added to the file (before the raw pixel data).

Normally, SizeOf(TBitmapFileHeader) + SizeOf(TBitmapInfoheader) should
BitmapFileHeader.bfOffBits. It works with all other modes (except palette
modes naturally) besides 15bit.

Does photoshop save a decoding mask with 15bit images?
What can those two longwords be?


Jon Lennart Aasenden