The MBM file format
Tutorial posted March 25th, 2003 by eric
in
| Offset | FieldName | Value | Comment |
| 0000 | Epoc Id | 3700 0010 | KDirectFileStoreLayoutUidValue |
| 0004 | Mbm Id | 4200 0010 | KMultiBitmapFileImageUid |
| 0008 | Constant | 0000 0000 | UID3, which is not needed in this case |
| 000C | Checksum | 3964 3947 | Checksum of the 3 UID's; Constant for all MBM's |
| 0010 | TrailerOffset | xxxx xxxx | Offset of Trailer in the file |
Bitmap Header and Pixels Data repeats for each bitmap within the MBM:
Bitmap Header
| Offset | FieldName | Value | Comment |
| Header offset | Length | xxxx xxxx | Includes these bytes and pixels data |
| Header+0004 | Header length | 2800 0000 | Always 0x28 |
| Header+0008 | X-Size | xxxx xxxx | Width of image in pixels |
| Header+000C | Y-Size | xxxx xxxx | Height of image in pixels |
| Header+0010 | Twips-X | xxxx xxxx | Width of image in twips, i.e. 1/1440 inch. These can be zero if X-Size and Y-Size are provided |
| Header+0014 | Twips-Y | xxxx xxxx | Height of image in twips |
| Header+0018 | Bits Per Pixel | xx00 0000 | 0x08 for a 256 colors bitmap |
| Header+001C | ImageIsColor | xx00 0000 | 0x00:No, 0x01:Yes, |
| Header+0020 | PaletteSize | xxxx xxxx | |
| Header+0024 | Compression | xx00 0000 | 0x00:No, 0x01:8BitRLE, 0x02:12BitRLE, 0x03:16BitRLE, 0x04:24BitRLE |
Pixels data
Not RLE compressed lines are rounded to 8 byte boundery
RLE (??? UNCOMPLETE)
Trailer
| Offset | FieldName | Value | Comment |
| Trailer+0000 | Number Of Bitmaps | xxxx xxxx | Number of pictures in the mbm file |
| Trailer+0004 | Header Offset for first bitmap | 1400 0000 | Always 0x0014 |
| Trailer+0008 | Header Offset for 2nd bitmap | xxxx xxxx | If present... |
| ... | ... | ... | ... |
The content of this article comes from the two following pages:
Frodo's Homepage
Rudy König's Homepage
Frodo's Homepage
Rudy König's Homepage






> The MBM file format
12 bit RLE compression looks like following:
1 RLE packet: [GGGGBBBB] [nnnnRRRR]
nnnn: n+1 is number of repetitions
RGB: are 4bit values of Red,Green,Blue
In my case I needed to create image with 8bits per color per pixel, so the conversion is
R = (R << 4) | R
G = (G << 4) | G
B = (B << 4 )| B