Qbasicnews.com

Full Version: Bitmap headers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does anyone have a link to some webpage that has good info on bitmap headers?
www.wotsit.org - but here:

Code:
TYPE bmpheader
    bftype            AS STRING * 2
    bfSize            AS LONG
    bfReserved1       AS INTEGER
    bfReserved2       AS INTEGER
    bfOffBits         AS LONG
    biSize            AS LONG
    biwidth           AS LONG
    biheight          AS LONG
    biPlanes          AS INTEGER
    bibitcount        AS INTEGER
    bicompression     AS LONG
    biSizeImage       AS LONG
    biXPelsPerMeter   AS LONG
    biYPelsPerMeter   AS LONG
    biClrUsed         AS LONG
    biClrImportant    AS LONG
END TYPE

DIM bmpheader AS bmpheader

OPEN "mybmp.bmp" FOR BINARY AS 1
GET #1, , bmpheader
CLOSE 1
Thanks, toonski.
toonski, another question.

How do I figure out bfsize? It isn't x * y + 54 (header size), and the difference between bfsize and bisizeimage always differs!!
bfSize in this case would be the size of the entire header structure, including the color table, plus the size of the bitmap data. I think the 8-bit header takes up 1078 bytes (don't hold me to that) and the data would take up x * y * bpp, which ends up being x * y for 8 bit DIBs. Normally, that header is split up into a BITMAPFILEHEADER and a BITMAPINFO (BITMAPINFOHEADER and a color table of RGBQUADs).
toonski: you forgot the Pal (1024 bytes)
BGR+padding.

And BMP's are stored Y-reversed. ;*)
is it possible to specify no palette?

Does one exist for 24 bit?
Yes it is possibel to specify no pallete lets also not forget there is an official 16bit .bmp format, and theres a BMP VER 5, whos header is MASSIVE

Quote:The Version 5 Header
Programs written for Windows 98 and Windows NT 5.0 can use DIBs that have a new BITMAPV5HEADER information structure:


typedef struct
{
DWORD bV5Size ; // size of the structure = 120
LONG bV5Width ; // width of the image in pixels
LONG bV5Height ; // height of the image in pixels
WORD bV5Planes ; // = 1
WORD bV5BitCount ; // bits per pixel (1, 4, 8, 16, 24, or 32)
DWORD bV5Compression ; // compression code
DWORD bV5SizeImage ; // number of bytes in image
LONG bV5XPelsPerMeter ; // horizontal resolution
LONG bV5YPelsPerMeter ; // vertical resolution
DWORD bV5ClrUsed ; // number of colors used
DWORD bV5ClrImportant ; // number of important colors
DWORD bV5RedMask ; // Red color mask
DWORD bV5GreenMask ; // Green color mask
DWORD bV5BlueMask ; // Blue color mask
DWORD bV5AlphaMask ; // Alpha mask
DWORD bV5CSType ; // color space type
CIEXYZTRIPLE bV5Endpoints ; // XYZ values
DWORD bV5GammaRed ; // Red gamma value
DWORD bV5GammaGreen ; // Green gamma value
DWORD bV5GammaBlue ; // Blue gamma value
DWORD bV5Intent ; // rendering intent
DWORD bV5ProfileData ; // profile data or filename
DWORD bV5ProfileSize ; // size of embedded data or filename
DWORD bV5Reserved ;
}
BITMAPV5HEADER, * PBITMAPV5HEADER ;

For the palette thing i can look it up for you how to change it but wotsit.org will tell you everything i can and you can leave the palette out for 8 bit mode if you want.
ok, but why do different bmps have different sizes? if no palette, then...?
Quote:toonski: you forgot the Pal (1024 bytes)
BGR+padding.

And BMP's are stored Y-reversed. ;*)

Y-reversed or just make the height parameter negative. Smile