.mic4D 49 43 21MIC is a compact, seekable binary container for bundling multiple images of heterogeneous formats into a single file. It is designed for asset pipelines, game engines, medical imaging, and any system that needs fast random access to individual frames or image layers without decompressing the entire container.
A MIC file is laid out sequentially in memory. The index table appears immediately after the fixed-size header, enabling parsers to validate and map the entire file with two reads.
0x20, so a parser can validate the magic, read image count, then load the entire index in one additional read(N × 64) call before seeking to any image.
0x00The file header is always exactly 32 bytes. All multi-byte integers are little-endian.
| Field | Offset | Size | Type | Description |
|---|---|---|---|---|
| magic | 0x00 | 4 B | u8[4] | Magic bytes: 4D 49 43 21 (ASCII MIC!). Must match exactly. |
| version | 0x04 | 2 B | u8, u8 | Major (byte 4) · Minor (byte 5). This spec is 01 00. |
| flags | 0x06 | 2 B | u16 LE | Global container flags. See §07 Flags. Bit 0 = has thumbnail block. |
| image_count | 0x08 | 2 B | u16 LE | Number of embedded images (0–65535). Determines index table size. |
| created_at | 0x0A | 8 B | u64 LE | Unix timestamp (microseconds since epoch) when file was created. |
| header_crc32 | 0x12 | 4 B | u32 LE | CRC-32 of bytes 0x00–0x11 (with this field zeroed during computation). |
| reserved | 0x16 | 10 B | u8[10] | Must be zero. Reserved for future use (extension chunk offsets, etc). |
N × 64 bytes at offset 0x20Each index entry is exactly 64 bytes. The table allows a reader to locate, verify, and describe any image in the container without reading any image data. Entries are ordered by insertion order (index 0 = first image added).
| Field | Offset in Entry | Size | Type | Description |
|---|---|---|---|---|
| data_offset | +0x00 | 8 B | u64 LE | Absolute byte offset from file start to the start of this image's data block. |
| data_size | +0x08 | 8 B | u64 LE | Byte length of the image data block (excluding padding). |
| width | +0x10 | 4 B | u32 LE | Image width in pixels. 0 if unknown/not applicable. |
| height | +0x14 | 4 B | u32 LE | Image height in pixels. 0 if unknown/not applicable. |
| codec_id | +0x18 | 2 B | u16 LE | Format identifier. See §08 Codec IDs. e.g. 0x0001 = PNG. |
| color_space | +0x1A | 1 B | u8 | Color space identifier. See §09. e.g. 0x01 = sRGB. |
| bit_depth | +0x1B | 1 B | u8 | Bits per channel (e.g. 8, 10, 12, 16, 32). |
| channel_count | +0x1C | 1 B | u8 | Number of channels (1 = grayscale, 3 = RGB, 4 = RGBA). |
| entry_flags | +0x1D | 1 B | u8 | Per-image flags. Bit 0 = has alpha, Bit 1 = has thumbnail, Bit 2 = encrypted. |
| thumb_index | +0x1E | 2 B | u16 LE | Index into thumbnail block for this image's thumb. 0xFFFF = no thumbnail. |
| data_crc32 | +0x20 | 4 B | u32 LE | CRC-32 of the raw image data bytes at data_offset. |
| label | +0x24 | 24 B | u8[24] | Null-terminated UTF-8 label / filename (max 23 chars + null). Remaining bytes zero. |
| reserved | +0x3C | 4 B | u8[4] | Must be zero. Reserved for per-entry extension use. |
0x20 through 0x20 + (image_count × 64). No image data needs to be read.
Present only when global flag bit 0 is set. Contains a compact sub-header followed by raw thumbnail data for each image that opted into thumbnails.
| Field | Offset | Size | Type | Description |
|---|---|---|---|---|
| thumb_magic | +0x00 | 4 B | u8[4] | Sub-block magic: 54 48 4D 42 (THMB). |
| thumb_count | +0x04 | 2 B | u16 LE | Number of thumbnail entries that follow. |
| thumb_width | +0x06 | 2 B | u16 LE | Uniform thumbnail width in pixels (e.g. 128). |
| thumb_height | +0x08 | 2 B | u16 LE | Uniform thumbnail height in pixels (e.g. 128). |
| thumb_codec | +0x0A | 2 B | u16 LE | Codec for all thumbnails (typically 0x0003 = JPEG for space efficiency). |
| reserved | +0x0C | 4 B | u8[4] | Zero-padded. |
| thumb_entries[] | +0x10 | variable | see below | Array of thumb_count variable-length entries. |
Each thumbnail entry is:
| Field | Size | Type | Description |
|---|---|---|---|
| thumb_data_size | 4 B | u32 LE | Byte length of thumbnail data that follows. |
| thumb_data | N B | u8[N] | Raw thumbnail bytes (JPEG, PNG, etc. per thumb_codec). |
| padding | 0–15 B | u8[] | Zero-padding to next 16-byte boundary. |
Each image data block stores the raw bytes of the encoded image. Blocks appear consecutively in index order, each starting at a 16-byte aligned offset to permit direct SIMD loads.
| Field | Size | Type | Description |
|---|---|---|---|
| block_magic | 4 B | u8[4] | Per-block magic: 49 4D 47 21 (IMG!). Allows forward scanning. |
| image_index | 2 B | u16 LE | Index of this image in the index table. For validation during forward scan. |
| block_reserved | 2 B | u8[2] | Zero-padded. |
| image_data | data_size B | u8[N] | Raw image bytes as stored by the codec (PNG IHDR…IEND, JPEG SOI…EOI, etc.). |
| padding | 0–15 B | u8[] | Null bytes to align next block to 16-byte boundary. padding = (16 - ((8 + data_size) % 16)) % 16 |
data_offset in the index entry points to the start of the 8-byte block header (IMG! magic), not to the image payload itself. Readers must skip 8 bytes to reach raw image data.
flags field at 0x06codec_id (u16)| codec_id | Name | MIME Type | Status |
|---|---|---|---|
| 0x0000 | RAW | image/raw | Core |
| 0x0001 | PNG | image/png | Core |
| 0x0002 | JPEG | image/jpeg | Core |
| 0x0003 | JPEG XL | image/jxl | Core |
| 0x0004 | WebP | image/webp | Core |
| 0x0005 | AVIF | image/avif | Core |
| 0x0006 | GIF | image/gif | Optional |
| 0x0007 | BMP | image/bmp | Optional |
| 0x0008 | TIFF | image/tiff | Optional |
| 0x0009 | HDR (RGBE) | image/vnd.radiance | Optional |
| 0x000A | EXR (OpenEXR) | image/x-exr | Optional |
| 0x000B | QOI | image/qoi | Optional |
| 0x0010–0x00FF | Animation frames | — | Reserved |
| 0x8000–0xFFFF | Vendor-defined | — | Custom |
0x0000)
When codec_id is RAW, image data is an uncompressed pixel buffer. Layout is determined by color_space, bit_depth, and channel_count. Row stride = width × channel_count × (bit_depth / 8), rows packed without padding.
color_space (u8)| Value | Name | Description |
|---|---|---|
| 0x00 | UNKNOWN | Color space not specified. |
| 0x01 | sRGB | Standard sRGB (IEC 61966-2-1). Most web images. |
| 0x02 | LINEAR_RGB | Linear light RGB. No gamma curve. |
| 0x03 | DISPLAY_P3 | Apple Display P3 wide gamut. |
| 0x04 | REC2020 | BT.2020 wide color gamut (HDR). |
| 0x05 | ADOBE_RGB | Adobe RGB (1998). |
| 0x06 | CMYK | 4-channel CMYK print space. |
| 0x07 | GRAYSCALE | Single-channel luminance. |
| 0x08 | LAB | CIE L*a*b* perceptual color space. |
| 0x09 | YCbCr | Luma + chroma (common in JPEG internals). |
| 0x80–0xFF | VENDOR | Vendor/application-defined color spaces. |
The final 8 bytes of a valid MIC file must be the EOF marker. This allows tail-readers and validators to quickly confirm a file was written completely.
Reader
Writer
The version field encodes [major, minor]. Readers should:
codec_id values must not cause a crash — report as unsupported codec.CHUNK_MAGIC (4B) + chunk_size (4B) + payload pattern so older readers can skip them. The 10 reserved bytes in the file header may be used for an extension chunk table offset in v1.x.
4D 49 43 2132 bytes64 bytes0x2016 bytes65,535Little-endianCRC-32