File: ImFileFormat.txt

package info (click to toggle)
libwildmagic 5.13-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 89,572 kB
  • ctags: 26,264
  • sloc: cpp: 210,924; csh: 637; sh: 95; makefile: 36
file content (52 lines) | stat: -rw-r--r-- 2,203 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
The *.im file format is a simple one.  It has a header block of data followed by the image data.

=====
For 2D images (like WildMagic5/Data/Im/Head.im), the file is organized as

char* uniqueIdentifier = "Magic Image"; // null-terminated string (12 bytes)
int numberOfDimensions = 2; // (4 bytes)
int xDimension;  // number of image columns (4 bytes)
int yDimension;  // number of image rows (4 bytes)
int rtti;   // type of pixels, see WildMagic5/LibImagics/Images/Wm5Element.cpp, (4 bytes)
int size;   // bytes per pixel [size of the pixel type], (4 bytes)
char* data;  // the image data in row-major order (row0 pixels, row1 pixels, ...)

Head.im has header listed as hexadecimal characters
    4D 61 67 69 63 20 49 6D 61 67 65 00 02 00 00 00
    00 01 00 00 00 01 00 00 03 00 00 00 02 00 00 00
    <data>

4D 61 67 69 63 20 49 6D 61 67 65 00 // "Magic Image\0"
02 00 00 00 // 2 dimensions
00 01 00 00 // 256 columns
00 01 00 00 // 256 rows
03 00 00 00 // pixels are of type 'unsigned short'
02 00 00 00 // size of 'unsigned short' is 2 bytes


=====
For 3D images (like WildMagic5/Data/Im/Molecule.im), the file is organized as

char* uniqueIdentifier = "Magic Image"; // null-terminated string (12 bytes)
int numberOfDimensions = 3; // (4 bytes)
int xDimension;  // number of image columns (4 bytes)
int yDimension;  // number of image rows (4 bytes)
int zDimension;  // number of image slices (4 bytes)
int rtti;   // type of voxels, see WildMagic5/LibImagics/Images/Wm5Element.cpp, (4 bytes)
int size;   // bytes per voxel [size of the voxel type], (4 bytes)
char* data;  // the image data in lexicographical order (slice0 voxels,
             // slice1 voxels, ...), each slice in row-major order

Molecule.im has header listed as hexadecimal characters
    4D 61 67 69 63 20 49 6D 61 67 65 00 03 00 00 00
    61 00 00 00 61 00 00 00 74 00 00 00 01 00 00 00
    01 00 00 00
    <data>

4D 61 67 69 63 20 49 6D 61 67 65 00 // "Magic Image\0"
03 00 00 00 // 3 dimensions
61 00 00 00 // 97 columns
61 00 00 00 // 97 rows
74 00 00 00 // 116 slices
01 00 00 00 // pixels are of type 'unsigned char'
01 00 00 00 // size of 'unsigned char' is 1 byte