An array encoded in the sane
format consists of
- The ASCII-encoded byte sequence SANE (0x53 0x41 0x4E 0x45)
- A little-endian uint32 encoding the length of the shape
- A little-endian1 shape as a sequence of little-endian uint64 sizes for each dimension
- A uint8 specifying the data type
- A little-endian uint64 encoding the byte length of the data of the array
- A sequence of the numbers as specified by the data-type in row-major order (C-order)
Supported data types are
- 0: float32
- 1: int32 (signed)
- 2: uint32 (unsigned)
- 3: float64
- 4: int64 (signed)
- 5: uint64 (unsigned)
- 6: int8 (signed)
- 7: uint8 (unsigned)
- 8-255: reserved
All supported data types are stored in little-endian byte order.
Footnotes
-
A little-endian shape has the fastest-changing dimension first. For the C-expressions
A[i][j]
, the size of the dimension corresponding toj
precedes the size of the dimension corresponding toi
. ↩