File: OpenEXRFileLayout.rst

package info (click to toggle)
openexr 3.4.6%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 41,948 kB
  • sloc: cpp: 166,793; ansic: 26,769; python: 2,990; sh: 581; makefile: 9
file content (1878 lines) | stat: -rw-r--r-- 92,818 bytes parent folder | download | duplicates (2)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
..
  SPDX-License-Identifier: BSD-3-Clause
  Copyright Contributors to the OpenEXR Project.

OpenEXR File Layout
###################

Document Purpose and Audience
=============================

This document gives an overview of the layout of OpenEXR 2.0 image files
as byte sequences. It covers both single and multi-part formats, and how
deep data is handled.

The text assumes that the reader is familiar with OpenEXR terms such as
"channel", "attribute", "data window" or "chunk". For an explanation of
those terms see :doc:`TechnicalIntroduction`.

**Note:** This document does not define the OpenEXR file format.  OpenEXR is
defined as the file format that is read and written by the OpenEXR open-source
C++ library. If this document and the OpenEXR library disagree, then the library
takes precedence.

Backwards Compatibility and New or Changed Functionality
========================================================

OpenEXR Backwards Compatibility (1.7 and 2.0)
---------------------------------------------

OpenEXR 1.7 and earlier format files are fully supported by OpenEXR 2.0.
You can still use the 1.7 file format with the 2.0 library. If you use
the 2.0 format for single-part scan line image and tile image data, your
data will be stored in the same way as the 1.7 files. You can recompile
your 1.7 files to take advantage of the new format EXRs (multiple-part
files, and/or deep scan line and deep tile data).

New Features for OpenEXR 2.0: Multi-Part and Deep Data
------------------------------------------------------

The multi-part format is an extension of the OpenEXR 1.7 single-part
file format. In addition to supporting the OpenEXR 1.7 data storage (a
single scan line or tiled image), OpenEXR 2.0 files can be used to store
multiple views and/or deep data (deep scan line or deep tiles).

While you can continue to use the 1.7 format for files, these changes to
the file layout are required to support the new multi-part and deep data
features:

.. list-table::
   :align: left
           
   * - Feature
     - Description
     - See
   * - Version field
     - Bits 11 and 12 indicate whether the file contains deep data
       (bit 11), or more than one part (bit 12).
     - `Deep Data`_
   * - Header
     - To store more than one part in the file, you need to have a
       header for each part.
     - `Structure`_
   * - Header attributes
     - There are a number of attributes which have been defined to
       store data which is relevant to deep data and multi-part
       files. These include: name (one for each part), data type (you
       can have different types of data in different views), and the
       maximum number of samples to take in a deep data channel.
     - `Multi-Part and Deep Data Header Attributes`_
   * - Offset tables and chunks
     - To store more than one part in the file, you need to have an
       offset table for each part, and chunks for each part.

       The chunks must begin with a part number.
     - `Component Four: Offset Tables`_ and `Chunk Layout`_.
       
   * - Deep Data
     - Deep data has a unique storage format.
     - `Deep Data`_.

Basic Data Types
================

An OpenEXR file is a sequence of 8-bit bytes. Groups of bytes represent
basic objects such as integral numbers, floating-point numbers and text.
Those objects are grouped together to form compound objects such as
attributes or scan lines.

Integers
--------

Binary integral numbers with 8, 16, 32 or 64 bits are stored as 1, 2, 4
or 8 bytes. Integral numbers can be signed or unsigned. Signed numbers
are represented using two's complement. Integral numbers are
little-endian (that is, the least significant byte is closest to the
start of the file).

OpenEXR uses the following six integer data types:

.. list-table::
   :align: left
   
   * - name
     - signed
     - size in bytes
   * - ``unsigned char``
     - no
     - 1
   * - ``short``
     - yes
     - 2
   * - ``unsigned short``
     - no
     - 2
   * - ``int``
     - yes
     - 4
   * - ``unsigned int``
     - no
     - 4
   * - ``unsigned long``
     - no
     - 8

Floating-Point Numbers
----------------------

Binary floating-point numbers with 16, 32 or 64 bits are stored as 2, 4
or 8 bytes. The representation of 32-bit and 64-bit floating-point
numbers conforms to the IEEE 754 standard. The representation of 16-bit
floating-point numbers is analogous to IEEE 754, but with 5 exponent
bits and 10 bits for the fraction. The exponent bias is 15.
Floating-point numbers are little-endian (that is: the least significant
bits of the fraction are in the byte closest to the beginning of the
file, while the sign bit and the most significant bits of the exponent
are in the byte closest to the end of the file).

The following table lists the names and sizes of OpenEXR's
floating-point data types:

.. list-table::
   :align: left

   * - name
     - size in bytes
   * - ``half``
     - 2
   * - ``float``
     - 4
   * - ``double``
     - 8

Text
----

Text strings are represented as sequences of 1-byte characters of type
``char``. Depending on the context, either the end of a string is
indicated by a null character (0x00), or the length of the string is
indicated by an ``int`` that precedes the string.

Packing
-------

Data in an OpenEXR file are densely packed; the file contains no
"padding". For example, consider the following C struct:

.. code-block::

    struct SI
    {
        short s;
        int i;
    };

On most computers, the in-memory representation of an ``SI`` object
occupies 8 bytes: 2 bytes for ``s``, 2 padding bytes to ensure four-byte
alignment of ``i``, and 4 bytes for ``i``. In an OpenEXR file the same
object would consume only 6 bytes: 2 bytes for ``s`` and 4 bytes for ``i``.
The 2 padding bytes are not stored in the file.

File Layout
===========

High-Level Layout
-----------------

Depending on whether the pixels in an OpenEXR file are stored as scan
lines or as tiles, the file consists of the following components:

+-----------+-----------------------------------------------+-----------------------------------+
| Component | single-part file with...                      |  multi-part file:                 |
+===========+=======================+=======================+===================================+
|           | scan-lines:           | tiles:                |                                   |
+-----------+-----------------------+-----------------------+-----------------------------------+
| one       | ``magic number``      | ``magic number``      | ``magic number``                  |
+-----------+-----------------------+-----------------------+-----------------------------------+
| two       | ``version field``     | ``version field``     | ``version field``                 | 
+-----------+-----------------------+-----------------------+-----------------------------------+
| three     | ``header``            | ``header``            | * ``part 0 header``               | 
|           |                       |                       | * ``[part 1 header]``             | 
|           |                       |                       | * ``...``                         | 
|           |                       |                       | * ``[<empty header>]``            | 
+-----------+-----------------------+-----------------------+-----------------------------------+
| four      | ``line offset table`` | ``line offset table`` | * ``part 0 chunk offset table``   |
|           |                       |                       | * ``[part 0 chunk offset table]`` |
|           |                       |                       | * ``...``                         |
+-----------+-----------------------+-----------------------+-----------------------------------+
| five      | ``scan line blocks``  | ``tiles``             | ``chunks``                        |
+-----------+-----------------------+-----------------------+-----------------------------------+

It is the version field part which indicates whether the file is single
or multi-part and whether the file contains deep data. “Chunk” is a
general term to describe blocks of pixel data. A chunk can be a scan
line block, a tile or deep data (scan line or tile).

Deep data has no unique component structure of its own, but uses the
structure that the file would have if it did not have deep data in it.

Comparison between Single-Part and Multi-Part File Layouts
----------------------------------------------------------

Multi-part files have the same high level structure as single-part
OpenEXR files, except the header, offset table and chunk components can
have any number (two or more) parts. There must be the same number of
headers as offset tables, and they must be in the same order. In
addition, the header component of a multi-part file must end with a null
byte (0x00). In multi-part files, each chunk contains a field that
indicates which part's data it contains.

Components One and Two: Magic Number and Version Field
======================================================

Magic Number
------------

The magic number, of type ``int``, is always 20000630 (decimal). It allows
file readers to distinguish OpenEXR files from other files, since the
first four bytes of an OpenEXR file are always 0x76, 0x2f, 0x31 and
0x01.

Version Field
-------------

The version field, of type ``int``, is the four-byte group following the
magic number, and it is treated as two separate bit fields.

+---------------------+-------------------------------------------------------------------------------------------------------------------------+
| Byte/bit position   | Description and notes                                                                                                   |
+=====================+=========================================================================================================================+
| first byte          | The 8 least significant bits, they                                                                                      |
| (bits 0 through 7)  | contain the file format version number.                                                                                 |
|                     |                                                                                                                         |
|                     | The current OpenEXR version number is version 2.                                                                        |
+---------------------+---------------------------------------+---------------------------------------------------------------------------------+
| second, third and   | The 24 most significant bits, these are treated as a set of boolean flags.                                              |
| fourth bytes (bits  |                                                                                                                         |
| 8 through 31)       +-----------------------------+---------------------------------------+---------------------------------------------------+
|                     | Bit 9 (the single tile bit) | Indicates that this is a single-part  | If bit 9 is 1:                                    |
|                     | bit mask: 0x200             | file which is in tiled format.        | * this is a regular single-part image and the     |
|                     |                             |                                       | pixels are stored as tiles, and                   |
|                     |                             |                                       | * bits 11 and 12 must be 0.                       |
|                     |                             |                                       |                                                   |
|                     |                             |                                       | If bit 9 is 0, and bits 11 and 12 are also 0:     |
|                     |                             |                                       | the data is stored as regular single-part scan    |
|                     |                             |                                       | line file.                                        |
|                     |                             |                                       |                                                   |
|                     |                             |                                       | This bit is for backwards compatibility with      |
|                     |                             |                                       | older libraries: it is only set when there is     |
|                     |                             |                                       | one "normal" tiled image in the file.             |
|                     +-----------------------------+---------------------------------------+---------------------------------------------------+
|                     | Bit 10 (the long name bit)  | Indicates whether the file contains   |                                                   |
|                     | bit mask: 0x400             | “long names”.                         |                                                   |
|                     |                             |                                       | If bit 10 is 1, the maximum length is 255 bytes.  |
|                     |                             |                                       |                                                   |
|                     |                             |                                       | If bit 10 is 0, the maximum length of attribute   |
|                     |                             |                                       | names, attribute type names and channel names     |
|                     |                             |                                       | is 31 bytes.                                      |
|                     +-----------------------------+---------------------------------------+---------------------------------------------------+
|                     | Bit 11 (the non-image bit)  | Indicates whether the file contains   | If bit 11 is 1, there is at least one             |
|                     | bit mask: 0x800             | any “non-image parts” (deep data).    | part which is not a regular scan line             |
|                     |                             |                                       | image or regular tiled image (that is, it         |
|                     |                             |                                       | is a deep format).                                |
|                     |                             |                                       |                                                   |
|                     |                             |                                       | If bit 11 is 0, all parts are entirely            |
|                     |                             |                                       | single or multiple scan line or tiled images.     |
|                     |                             |                                       |                                                   |
|                     |                             |                                       | New in 2.0.                                       |
|                     +-----------------------------+---------------------------------------+---------------------------------------------------+
|                     | Bit 12 (the multipart bit)  | Indicates the file is a               | If bit 12 is 1:                                   |
|                     | bit mask: 0x1000            | multi-part file.                      | * the file does not contain exactly 1             |
|                     |                             |                                       | part and the 'end of header' byte                 |
|                     |                             |                                       | must be included at the end of each               |
|                     |                             |                                       | header part, and                                  |
|                     |                             |                                       | * the part number fields must be added            |
|                     |                             |                                       | to the chunks.                                    |
|                     |                             |                                       |                                                   |
|                     |                             |                                       | If bit 12 is 0, this is not a multi-part          |
|                     |                             |                                       | file and the 'end of header' byte and             |
|                     |                             |                                       | part number fields in chunks must                 |
|                     |                             |                                       | be omitted.                                       |
|                     |                             |                                       |                                                   |
|                     |                             |                                       | New in 2.0.                                       |
|                     +-----------------------------+---------------------------------------+---------------------------------------------------+
|                     | The remaining 19 flags in the version field are currently unused and should be set to 0.                                |
+---------------------+-------------------------------------------------------------------------------------------------------------------------+

Version field, valid values
~~~~~~~~~~~~~~~~~~~~~~~~~~~

All valid combinations of the version field bits are as follows:

.. list-table::
   :header-rows: 1
   :align: left
                 
   * - Description
     - Compatible with
     - bit 9
     - bit 11
     - bit 12
   * - Single-part scan line.
       One normal scan line image.
     - All versions of OpenEXR.
     - 0
     - 0
     - 0
   * - Single-part tile.
     - All versions of OpenEXR.
       One normal tiled image.
     - 1
     - 0
     - 0
   * - Multi-part (new in 2.0).
       Multiple normal images (scan line and/or tiled).
     - OpenEXR 2.0.
     - 0
     - 0
     - 1
   * - Single-part deep data (new in 2.0).
       One deep tile or deep scan line part.
     - OpenEXR 2.0.
     - 0
     - 1
     - 0
   * - Multi-part deep data (new in 2.0).
       Multiple parts (any combination of: tiles, scan lines,
       deep tiles and/or deep scan lines).
     - OpenEXR 2.0.
     - 0
     - 1
     - 1

**Note:** The version field bits define what capabilities must be
available in the software so it can handle the file, rather than the
exact format of the file. While the 9 and 11 bit settings must agree
with the type attributes of all parts, in OpenEXR 2.0 the data format of
each type is definitively set by the type attribute in that part's
header alone.

Component Three: Header
=======================

Structure
---------

Single-part file
~~~~~~~~~~~~~~~~

The header component of the single-part file holds a single header (for
single-part files).

Each header is a sequence of attributes ended by a null byte.

The file has the same structure as a 1.7 file. That is, the multi-part
bit (bit 12) must be 0, and the single null byte that signals the end of
the headers must be omitted. This structure also applies to single-part
deep data files.

Multi-part file (new in 2.0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The header component of a multi-part file holds a set of headers, with a
separate header for each part (in multi-part files) and a null byte
signalling the end of the header component:

===================== =
``part 0 header``
``[part 1 header]``
``...``
``[<empty header>]``
===================== =

Each header is a sequence of attributes ended by a null byte.

The multipart bit (bit 12) must be set to 1, and the list of headers
must be followed by a single null byte (0x00) (that is, an empty
header).

Attribute Layout
----------------

The layout of an attribute is as follows:

===================== =
attribute type
attribute size
attribute value
===================== =

The ``attribute name`` and the ``attribute type`` are null-terminated
text strings. Excluding the null byte, the name and type must each be as
least 1 byte and at most :

*  31 bytes long (if bit 10 is set to 0), or
*  255 bytes long (if bit 10 is set to 1).

Both single-part and multi-part files use the same attribute types.

The ``attribute size``, of type ``int``, indicates the size (in bytes) of
the attribute value.

The layout of the ``attribute value`` depends on the attribute
type. The OpenEXR library predefines several different attribute
types. Application programs can define and store additional attribute
types.

Header Attributes (All Files)
-----------------------------

The header of every OpenEXR file must contain at least the following
attributes:

.. list-table::
   :header-rows: 1
   :align: left

   * - attribute name
     - attribute type
   * - ``channels``
     - ``chlist``
   * - ``compression``
     - ``compression``
   * - ``dataWindow``
     - ``box2i``
   * - ``displayWindow``
     - ``box2i``
   * - ``lineOrder``
     - ``lineOrder``
   * - ``pixelAspectRatio``
     - ``float``
   * - ``screenWindowCenter``
     - ``v2f``
   * - ``screenWindowWidth``
     - ``float``

For descriptions of what these attributes are for, see
:doc:`TechnicalIntroduction`.

Tile Header Attribute
---------------------

This attributes is required in the header for all files which contain
one or more tiles:

.. list-table::
   :header-rows: 1
   :align: left

   * - attribute name
     - attribute type
     - notes
   * - ``tiles``
     - ``tiledesc``
     - Determines the size of the tiles and the number of resolution levels
       in the file. 

       **Note:** The OpenEXR library ignores tile description attributes in
       scan line based files. The decision whether the file contains scan
       lines or tiles is based on the value of bit 9 in the file's version
       field, not on the presence of a tile description attribute.

Multi-View Header Attribute
---------------------------

This attribute can be used in the header for multi-part files:

.. list-table::
   :header-rows: 1
   :align: left

   * - attribute name
     - attribute type
     - notes
   * - ``view``
     - ``text``
     -

Multi-Part and Deep Data Header Attributes
------------------------------------------

These attributes are required in the header for all multi-part and/or
deep data OpenEXR files.

.. list-table::
   :header-rows: 1
   :align: left

   * - attribute name
     - attribute type
     - notes
   * - ``name``
     - ``string``
     - Required if either the multipart bit (12) or the non-image bit (11) is set.
       
   * - ``type``
     - ``string``
     - Required if either the multipart bit (12) or the non-image bit (11) is set.
       Set to one of:

       * ``scanlineimage``
       * ``tiledimage``
       * ``deepscanline``, or
       * ``deeptile``

       **Note:** This value must agree with the version field's tile bit (9) and
       non-image (deep data) bit (11) settings.  
   * - ``version``
     - ``int``
     - This document describes version 1 data for all part types.
       version is required for deep data (deepscanline and deeptile) parts. If
       not specified for other parts, assume version=1.  
   * - ``chunkCount``
     - ``int``
     - Required if either the multipart bit (12) or the non-image bit (11) is set.
   * - ``tiles``
     - ``tileDesc``
     - Required for parts of type ``tiledimage`` and ``deeptile``.

Deep Data Header Attributes
---------------------------

These attributes are required in the header for all files which contain
deep data (deepscanline or deeptile):

.. list-table::
   :header-rows: 1
   :align: left

   * - attribute name
     - attribute type
     - notes
   * - ``tiles``
     - ``tileDesc``
     - Required for parts of type tiledimage and deeptile.
   * - ``maxSamplesPerPixel``
     - ``int``
     - Required for deep data (deepscanline and deeptile) parts.
       **Note:** Since the value of ``maxSamplesPerPixel`` maybe be unknown at
       the time of opening the file, the value “\ *-1*\ ” is written to the file
       to indicate an unknown value. When the file is closed, this will be
       overwritten with the correct value. If file writing does not complete
       correctly due to an error, the value *-1* will remain. In this case, the
       value must be derived by decoding each chunk in the part. 
   * - ``version``
     - ``int``
     - Should be set to ``1``. It will be changed if the format is updated. 
   * - ``type``
     - ``string``
     - Must be set to ``deepscanline`` or ``deeptile``.

For information about channel layout and a list of reserved channel
names, see :ref:`channel-names-label` in :doc:`TechnicalIntroduction`.

Component Four: Offset Tables
=============================

Offset Tables
-------------

An offset table allows random access to pixel data chunks. An offset
table is a sequence of offsets, with one offset per chunk. Each offset
(of type ``unsigned long``) indicates the distance, in bytes, between the
start of the file and the start of the chunk.

Chunks can be of any of the four data types.

Offset Table Size
-----------------

The number of entries in an offset table is defined in one of two ways:

1. If the multipart (12) bit is unset and the chunkCount is not present,
   the number of entries in the chunk table is computed using the
   dataWindow and tileDesc attributes and the compression format.
2. If the multipart (12) bit is set, the header must contain a
   chunkCount attribute (which indicates the size of the table and the
   number of chunks).

Scan Lines
----------

For scan line blocks, the line offset table is a sequence of scan line
offsets, with one offset per scan line block. In the table, scan line
offsets are ordered according to increasing scan line y coordinates.

Tiles
-----

For tiles, the offset table is a sequence of tile offsets, one offset
per tile. In the table, scan line offsets are sorted the same way as
tiles in ``INCREASING_Y`` order.

Multi-Part
----------

For multi-part files, each part defined in the header component has a
corresponding chunk offset table.

Component Five: Pixel data
==========================

Chunk Layout
------------

A “chunk” is a general term for a pixel data block. The scan line and
tile images have the same format that they did in OpenEXR 1.7. OpenEXR
2.0 introduces two new types (deep scan line and deep tile).

The layout of each chunk is as follows:

============================================== =
``[part number]`` (if multi-part bit is set)
``chunk data``
============================================== =

The ``part number`` (of type ``unsigned long``) is only present in
multi-part files. It indicates which part this chunk belongs to. 0
indicates the chunk belongs to the part defined by the first header and
the first chunk offset table. The part number is omitted if the
multi-part bit (12) is not set (this saves space and enforces backwards
compatibility to software which does not support multi-part files).

The ``chunk data`` is dependent on the type attribute - but (other than
the part number) has the same structure as a single-part file of the
same format:

.. list-table::
   :header-rows: 1
   :align: left

   * - part type
     - type attribute
     - notes
   * - scan line
     - indicated by a type attribute of “scanlineimage”
     - Each chunk stores a scan line block, with the minimum y coordinate of the
       scan line(s) within the chunk.
       See `Regular scan line image block layout`_.
   * - tiled
     - indicated by a type attribute of “tiledimage”
     - See `Regular image tile layout`_.
   * - deep scan line
     - indicated by a type attribute of “deepscanline”
     - See `Deep scan line layout`_.
   * - deep tile
     - indicated by a type attribute of “deeptile”
     - See `Deep tiled layout`_.

Regular Scan Line Blocks
------------------------

For scan line images and deep scan line images, one or more scan lines
may be stored together as a scan line block. The number of scan lines
per block depends on how the pixel data are compressed:

.. list-table::
   :align: left

   * - ``NO_COMPRESSION``
     - 1 
   * - ``RLE_COMPRESSION``
     - 1 
   * - ``ZIPS_COMPRESSION``
     - 1 
   * - ``ZIP_COMPRESSION``
     - 16
   * - ``PIZ_COMPRESSION``
     - 32
   * - ``PXR24_COMPRESSION``
     - 16
   * - ``B44_COMPRESSION``
     - 32
   * - ``B44A_COMPRESSION``
     - 32
   * - ``DWAA_COMPRESSION``
     - 32
   * - ``DWAB_COMPRESSION``
     - 256
   * - ``HTJ2K256_COMPRESSION``
     - 256
   * - ``HTJ2K32_COMPRESSION``
     - 32

Each scan line block has a y coordinate of type ``int``. The block's y
coordinate is equal to the pixel space y coordinate of the top scan line
in the block. The top scan line block in the image is aligned with the
top edge of the data window (that is, the y coordinate of the top scan
line block is equal to the data window's minimum y).

If the height of the image's data window is not a multiple of the number
of scan lines per block, then the block that contains the bottom scan
line contains fewer scan lines than the other blocks.

Regular scan line image block layout
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The layout of a regular image scan line block is as follows:

=================== =
y coordinate
pixel data size
pixel data
=================== =

The ``pixel data size``, of type ``int``, indicates the number of bytes
occupied by the actual pixel data.

Within the ``pixel data``, scan lines are stored top to bottom. Each
scan line is contiguous, and within a scan line the data for each
channel are contiguous. Channels are stored in alphabetical order,
according to channel names. Within a channel, pixels are stored left to
right.

Compressed data
~~~~~~~~~~~~~~~

If the file's compression method is ``NO_COMPRESSION``, then the original,
uncompressed pixel data are stored directly in the file. Otherwise, the
uncompressed pixels are fed to the appropriate compressor, and either
the compressed or the uncompressed data are stored in the file,
whichever is smaller.

The layout of the compressed data depends on which compression method
was applied. The compressed formats are not described here. For
information on the compressed data formats, see the source code for the
OpenEXR library.

Regular ImageTiles
------------------

Regular image tile layout
~~~~~~~~~~~~~~~~~~~~~~~~~

The layout of a regular image tile is as follows:

=================== =
tile coordinates
pixel data size
pixel data
=================== =

The ``tile coordinates``, a sequence of four ``int``'s (``tileX``, ``tileY``,
``levelX``, ``levelY``) indicates the tile's position and resolution level. The
``pixel data size``, of type ``int``, indicates the number of bytes
occupied by the pixel data.

The ``pixel data`` in a tile are laid out in the same way as in a scan
line block, but the length of the scan lines is equal to the width of
the tile, and the number of scan lines is equal to the height of the
tile.

If the width of a resolution level is not a multiple of the file's tile
width, then the tiles at the right edge of that resolution level have
shorter scan lines. Similarly, if the height of a resolution level is
not a multiple of the file's tile height, then tiles at the bottom edge
of the resolution level have fewer scan lines.

Deep Data
---------

Deep images store an arbitrarily long list of data at each pixel
location (each pixel contains a list of samples, and each sample
contains a fixed number of channels).

Deep scan line layout
~~~~~~~~~~~~~~~~~~~~~

Deep scan line images are indicated by a type attribute of
“deepscanline”. Each chunk of deep scan line data is a single scan line
of data. The data in each chunk is laid out as follows:

======================================== =
[part number] (if multipart bit is set) 
y coordinate                            
packed size of pixel offset table       
packed size of sample data              
unpacked size of sample data            
compressed pixel offset table           
compressed sample data                  
======================================== =

The ``unpacked size of the sample data`` (an ``unsigned long``) is the
size of the deep sample data once it is unpacked. It is necessary to
specify the unpacked size since the data may be arbitrarily large (so
generally cannot otherwise be determined without decompressing the data
first).

Deep tiled layout
~~~~~~~~~~~~~~~~~

Tiled images are indicated by a type attribute of “deeptile”. Each chunk
of deep tile data is a single tile. The data in each chunk is laid out
as follows:

=========================================== =
[part number] (if multipart bit is set) 
tile coordinates                        
packed size of pixel offset table       
packed size of sample data              
unpacked size of sample data            
compressed pixel offset table           
compressed sample data                  
=========================================== =

The ``unpacked size of the sample data`` (an ``unsigned long``) is the
size of the deep data once it is unpacked. It is necessary to specify
the unpacked size since the data may be arbitrarily large (so generally
cannot otherwise be determined without decompressing the data first).

The ``pixel offset table`` is a list of ``int``, one for each column within
the dataWindow. Each entry ``n`` in the table indicates the total number of
samples required to store the pixel in ``n`` as well as all pixels to the left
of it. Thus, the first samples stored in each channel of the pixel data are for
the pixel in column 0, which contains ``table[1]`` samples. Each channel
contains ``table[width-1]`` samples in total.

Unpacked deep data chunks
~~~~~~~~~~~~~~~~~~~~~~~~~

When decompressed, the unpacked chunk consists of the channel data
stored in a non-interleaved fashion:

=========================================== =
pixel sample data for channel 0    
pixel sample data for channel 1    
pixel sample data for channel ...  
pixel sample data for channel n    
=========================================== =


**Exception:** For ``ZIP_COMPRESSION`` only there will be up to 16
scanlines in the packed sample data block:

================================================= =
pixel sample data for channel 0 for scanline 0   
pixel sample data for channel 1 for scanline 0   
pixel sample data for channel ... for scanline 0 
pixel sample data for channel n for scanline 0   
pixel sample data for channel 0 for scanline 1   
pixel sample data for channel 1 for scanline 1   
pixel sample data for channel ... for scanline 1 
pixel sample data for channel n for scanline 1
...                                              
================================================= =


Deep data compression
~~~~~~~~~~~~~~~~~~~~~

The following compression schemes are the only ones permitted for deep
data:

==================== ==
``NO_COMPRESSION``   1 
``RLE_COMPRESSION``  1 
``ZIPS_COMPRESSION`` 1 
``ZIP_COMPRESSION``  16
==================== ==

Predefined Attribute Types
==========================

The OpenEXR library predefines the following attribute types:

+--------------------+-----------------------------------------------------------------+
| type name          | data                                                            |
+====================+=================================================================+
| ``box2i``          | Four ``int``\ 's: ``xMin``, ``yMin``, ``xMax``, ``yMax``        |
+--------------------+-----------------------------------------------------------------+
| ``box2f``          | Four ``float``\ 's: ``xMin``, ``yMin``, ``xMax``, ``yMax``      |
+--------------------+-----------------------------------------------------------------+
| ``bytes``          | A sequence of ``unsigned char`` values. The bytes are           |
|                    | accompanied by an optional (but encouraged) type hint.          |
|                    | (new in OpenEXR v3.4)                                           |
|                    +----------------+------------------------------------------------+
|                    | ``hintLength`` | ``unsigned int``                               |
|                    +----------------+------------------------------------------------+
|                    | ``typeHint``   | A sequence of chars of length ``hintLength``.  |
|                    +-----------------------------------------------------------------+
|                    | The bytes payload follows and can be up to INT32_MAX bytes in   |
|                    | length.                                                         |
+--------------------+-----------------------------------------------------------------+
| ``chlist``         | A sequence of channels followed by a null byte (``0x00``).      |
|                    | Channel layout:                                                 |
|                    +----------------+------------------------------------------------+
|                    | name           | zero-terminated string, from 1 to 255 bytes    |
|                    |                | long                                           |
|                    +----------------+------------------------------------------------+
|                    | ``pixel type`` | ``int``, possible values are:                  |
|                    |                |                                                |
|                    |                | * ``UINT`` = 0                                 |
|                    |                | * ``HALF`` = 1                                 |
|                    |                | * ``FLOAT`` = 2                                |
|                    |                |                                                |
|                    +----------------+------------------------------------------------+
|                    | ``pLinear``    | ``unsigned char``, possible values are 0 and 1 |
|                    +----------------+------------------------------------------------+
|                    | ``reserved``   | three ``char``, should be zero                 |
|                    +----------------+------------------------------------------------+
|                    | ``xSampling``  | ``int``                                        |
|                    +----------------+------------------------------------------------+
|                    | ``ySampling``  | ``int``                                        |
+--------------------+----------------+------------------------------------------------+
| ``chromaticities`` | Eight ``float``: ``redX``, ``redY``, ``greenX``,                |
|                    | ``greenY``, ``blueX``, ``blueY``, ``whiteX``, ``whiteY``        |
+--------------------+-----------------------------------------------------------------+
| ``compression``    | ``unsigned char``, possible values are:                         |
|                    |                                                                 |
|                    | * ``NO_COMPRESSION`` = 0                                        |
|                    | * ``RLE_COMPRESSION`` = 1                                       |
|                    | * ``ZIPS_COMPRESSION`` = 2                                      |
|                    | * ``ZIP_COMPRESSION`` = 3                                       |
|                    | * ``PIZ_COMPRESSION`` = 4                                       |
|                    | * ``PXR24_COMPRESSION`` = 5                                     |
|                    | * ``B44_COMPRESSION`` = 6                                       |
|                    | * ``B44A_COMPRESSION`` = 7                                      |
|                    | * ``DWAA_COMPRESSION`` = 8                                      |
|                    | * ``DWAB_COMPRESSION`` = 9                                      |
|                    | * ``HTJ2K256_COMPRESSION`` = 10                                 |
|                    | * ``HTJ2K32_COMPRESSION`` = 11                                  |
|                    |                                                                 |
+--------------------+-----------------------------------------------------------------+
| ``double``         | ``double``                                                      |
+--------------------+-----------------------------------------------------------------+
| ``envmap``         | ``unsigned char``, possible values are:                         |
|                    |                                                                 |
|                    | * ``ENVMAP_LATLONG`` = 0                                        |
|                    | * ``ENVMAP_CUBE`` = 1                                           |
|                    |                                                                 |
+--------------------+-----------------------------------------------------------------+
| ``float``          | ``float``                                                       |
+--------------------+-----------------------------------------------------------------+
| ``int``            | ``int``                                                         |
+--------------------+-----------------------------------------------------------------+
| ``keycode``        | Seven ``int``\ 's: ``filmMfcCode``, ``filmType``, ``prefix``,   |
|                    | ``count``, ``perfOffset``, ``perfsPerFrame``, ``perfsPerCount`` |
+--------------------+-----------------------------------------------------------------+
| ``lineOrder``      | ``unsigned char``, possible values are:                         |
|                    |                                                                 |
|                    | * ``INCREASING_Y`` = 0                                          |
|                    | * ``DECREASING_Y`` = 1                                          |
|                    | * ``RANDOM_Y`` = 2                                              |
|                    |                                                                 |
+--------------------+-----------------------------------------------------------------+
| ``m33f``           | 9 ``float``\ 's                                                 |
+--------------------+-----------------------------------------------------------------+
| ``m44f``           | 16 ``float``\ 's                                                |
+--------------------+-----------------------------------------------------------------+
| ``preview``        | Two ``unsigned int``\ 's, width and height, followed by         |
|                    | 4×width×height ``unsigned char``\ 's of pixel data.             |
|                    | Scan lines are stored top to bottom; within a scan line         |
|                    | pixels are stored from left to right. A pixel consists of       |
|                    | four ``unsigned char``\ 's, ``R``, ``G``, ``B``, ``A``.         |
+--------------------+-----------------------------------------------------------------+
| ``rational``       | An ``int``, followed by an ``unsigned int``.                    |
+--------------------+-----------------------------------------------------------------+
| ``string``         | String length, of type ``int``, followed by a sequence of       |
|                    | ``char``\ 's.                                                   |
+--------------------+-----------------------------------------------------------------+
| ``stringvector``   | A sequence of zero or more text strings. Each string is         | 
|                    | represented as a string length, of type ``int``, followed by a  |
|                    | sequence of ``chars``. The number of strings can be inferred    |
|                    | from the total attribute size                                   |
|                    | (see the `Attribute Layout`_ section).                          |
+--------------------+-----------------------------------------------------------------+
| ``tiledesc``       | Two ``unsigned int``\ 's: ``xSize``, ``ySize``, followed        |
|                    | by ``mode``, of type ``unsigned char``, where                   |
|                    |                                                                 |
|                    |     mode = levelMode + roundingMode×16                          |
|                    |                                                                 |
|                    | Possible values for ``levelMode``:                              |
|                    |                                                                 |
|                    | * ``ONE_LEVEL`` = 0                                             |
|                    | * ``MIPMAP_LEVELS`` = 1                                         |
|                    | * ``RIPMAP_LEVELS`` = 2                                         |
|                    |                                                                 |
|                    | Possible values for ``roundingMode``:                           |
|                    |                                                                 |
|                    | * ``ROUND_DOWN`` = 0                                            |
|                    | * ``ROUND_UP`` = 1                                              |
|                    |                                                                 |
+--------------------+-----------------------------------------------------------------+
| ``timecode``       | Two ``unsigned int``\ 's: ``timeAndFlags``, ``userData``.       |
+--------------------+-----------------------------------------------------------------+
| ``v2i``            | Two ``int``\ 's                                                 |
+--------------------+-----------------------------------------------------------------+
| ``v2f``            | Two ``float``\ 's                                               |
+--------------------+-----------------------------------------------------------------+
| ``v3i``            | Three ``int``\ 's.                                              |
+--------------------+-----------------------------------------------------------------+
| ``v3f``            | Three ``float``\ 's.                                            |
+--------------------+-----------------------------------------------------------------+


Sample File
===========

The following is an annotated byte-by-byte listing of a complete OpenEXR
file. The file contains a scan-line based image with four by three
pixels. The image has two channels: G, of type ``HALF``, and Z, of type
``FLOAT``. The pixel data are not compressed. The entire file is 415 bytes
long.

The first column of the table below lists all the bytes of the file in hexadecimal 
notation. The second column of the table shows how the bytes are grouped into 
integers, floating-point numbers and text strings. The third column of the table
indicate how those basic objects form compound objects such as attributes 
or the line offset table.

Download the :download:`sample.exr <downloads/sample.exr>`.

.. table::
  :width: 50%

  +-----------+------------+-----------------------+
  |byte       |value       |description            |
  +===========+============+=======================+
  |76         |20000630    |``magic number``       |
  +-----------+            |                       |
  |2f         |            |                       |
  +-----------+            |                       |
  |31         |            |                       |
  +-----------+            |                       |
  |01         |            |                       |
  +-----------+------------+-----------------------+
  |02         |2           |``version, flags``     |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  | Start of header                                |
  +-----------+------------+-----------------------+
  |63         |c           |attribute              |
  +-----------+------------+name:                  |
  |68         |h           |``channels``           |
  +-----------+------------+                       |
  |61         |a           |                       |
  +-----------+------------+                       |
  |6e         |n           |                       |
  +-----------+------------+                       |
  |6e         |n           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |6c         |l           |                       |
  +-----------+------------+                       |
  |73         |s           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |63         |c           |attribute              |
  +-----------+------------+type:                  |
  |68         |h           |``chlist``             |
  +-----------+------------+                       |
  |6c         |l           |                       |
  +-----------+------------+                       |
  |69         |i           |                       |
  +-----------+------------+                       |
  |73         |s           |                       |
  +-----------+------------+                       |
  |74         |t           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |25         |37          |attribute              |
  +-----------+            |size                   |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |47         |G           |G channel              |
  +-----------+            |struct values          |
  |00         |\\0         |                       |
  +-----------+------------+                       |
  |01         |type: HALF  |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+                       |
  |00         |pLinear:0   |                       |
  +-----------+------------+                       |
  |00         |0           |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+                       |
  |01         |xSampling: 1|                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+                       |
  |01         |ySampling: 1|                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |5a         |Z           |Z channel              |
  +-----------+            |struct values          |
  |00         |\\0         |                       |
  +-----------+------------+                       |
  |02         |type: FLOAT |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+                       |
  |00         |pLinear: 0  |                       |
  +-----------+------------+                       |
  |00         |0           |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+                       |
  |01         |xSampling: 1|                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+                       |
  |01         |ySampling: 1|                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |63         |c           |attribute              |
  +-----------+------------+name:                  |
  |6f         |o           |``compression``        |
  +-----------+------------+                       |
  |6d         |m           |                       |
  +-----------+------------+                       |
  |70         |p           |                       |
  +-----------+------------+                       |
  |72         |r           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |73         |s           |                       |
  +-----------+------------+                       |
  |73         |s           |                       |
  +-----------+------------+                       |
  |69         |i           |                       |
  +-----------+------------+                       |
  |6f         |o           |                       |
  +-----------+------------+                       |
  |6e         |n           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |63         |c           |attribute              |
  +-----------+------------+type:                  |
  |6f         |o           |``compression``        |
  +-----------+------------+                       |
  |6d         |m           |                       |
  +-----------+------------+                       |
  |70         |p           |                       |
  +-----------+------------+                       |
  |72         |r           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |73         |s           |                       |
  +-----------+------------+                       |
  |73         |s           |                       |
  +-----------+------------+                       |
  |69         |i           |                       |
  +-----------+------------+                       |
  |6f         |o           |                       |
  +-----------+------------+                       |
  |6e         |n           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |01         |1           |attribute              |
  +-----------+            |size                   |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |00         | None       |attribute              |
  |           |            |value                  |
  +-----------+------------+-----------------------+
  |64         |d           |attribute              |
  +-----------+------------+name:                  |
  |61         |a           |``dataWindow``         |
  +-----------+------------+                       |
  |74         |t           |                       |
  +-----------+------------+                       |
  |61         |a           |                       |
  +-----------+------------+                       |
  |57         |W           |                       |
  +-----------+------------+                       |
  |69         |i           |                       |
  +-----------+------------+                       |
  |6e         |n           |                       |
  +-----------+------------+                       |
  |64         |d           |                       |
  +-----------+------------+                       |
  |6f         |o           |                       |
  +-----------+------------+                       |
  |77         |w           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |62         |b           |attribute              |
  +-----------+------------+type: ``box2i``        |
  |6f         |o           |                       |
  +-----------+------------+                       |
  |78         |x           |                       |
  +-----------+------------+                       |
  |32         |2           |                       |
  +-----------+------------+                       |
  |69         |i           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |10         |16          |attribute              |
  +-----------+            |size                   |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |00         |0           |                       |
  +-----------+(box.min.x) |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |00         |0           |                       |
  +-----------+(box.min.y) |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |03         |3           |                       |
  +-----------+(box.max.x) |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |02         |2           |                       |
  +-----------+(box.max.y) |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |64         |d           |attribute              |
  +-----------+------------+name:                  |
  |69         |i           |``displayWindow``      |
  +-----------+------------+                       |
  |73         |s           |                       |
  +-----------+------------+                       |
  |70         |p           |                       |
  +-----------+------------+                       |
  |6c         |l           |                       |
  +-----------+------------+                       |
  |61         |a           |                       |
  +-----------+------------+                       |
  |79         |y           |                       |
  +-----------+------------+                       |
  |57         |W           |                       |
  +-----------+------------+                       |
  |69         |i           |                       |
  +-----------+------------+                       |
  |6e         |n           |                       |
  +-----------+------------+                       |
  |64         |d           |                       |
  +-----------+------------+                       |
  |6f         |o           |                       |
  +-----------+------------+                       |
  |77         |w           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |62         |b           |attribute              |
  +-----------+------------+type: ``box2i``        |
  |6f         |o           |                       |
  +-----------+------------+                       |
  |78         |x           |                       |
  +-----------+------------+                       |
  |32         |2           |                       |
  +-----------+------------+                       |
  |69         |i           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |10         |16          |attribute              |
  +-----------+            |size                   |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |00         |0           |                       |
  +-----------+(box.min.x) |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+                       +
  |00         |0           |                       |
  +-----------+(box.min.y) |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |03         |3           |                       |
  +-----------+(box.max.x) |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+                       +
  |02         |2           |                       |
  +-----------+(box.max.y) |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |6c         |l           |attribute              |
  +-----------+------------+name:                  |
  |69         |i           |``lineOrder``          |
  +-----------+------------+                       |
  |6e         |n           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |4f         |O           |                       |
  +-----------+------------+                       |
  |72         |r           |                       |
  +-----------+------------+                       |
  |64         |d           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |72         |r           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |6c         |l           |attribute              |
  +-----------+------------+type: ``lineOrder``    |
  |69         |i           |                       |
  +-----------+------------+                       |
  |6e         |n           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |4f         |O           |                       |
  +-----------+------------+                       |
  |72         |r           |                       |
  +-----------+------------+                       |
  |64         |d           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |72         |r           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |01         |1           |attribute              |
  +-----------+            |size                   |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |00         |0           |INCY value             |
  +-----------+------------+-----------------------+
  |70         |p           |attribute              |
  +-----------+------------+name:                  |
  |69         |i           |``pixelAspectRatio``   |
  +-----------+------------+                       |
  |78         |x           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |6c         |l           |                       |
  +-----------+------------+                       |
  |41         |A           |                       |
  +-----------+------------+                       |
  |73         |s           |                       |
  +-----------+------------+                       |
  |70         |p           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |63         |c           |                       |
  +-----------+------------+                       |
  |74         |t           |                       |
  +-----------+------------+                       |
  |52         |R           |                       |
  +-----------+------------+                       |
  |61         |a           |                       |
  +-----------+------------+                       |
  |74         |t           |                       |
  +-----------+------------+                       |
  |69         |i           |                       |
  +-----------+------------+                       |
  |6f         |o           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |66         |f           |attribute              |
  +-----------+------------+type: ``float``        |
  |6c         |l           |                       |
  +-----------+------------+                       |
  |6f         |o           |                       |
  +-----------+------------+                       |
  |61         |a           |                       |
  +-----------+------------+                       |
  |74         |t           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |04         |4           |attribute              |
  +-----------+            |size                   |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |00         |1.0         |attribute              |
  +-----------+            |value                  |
  |00         |            |                       |
  +-----------+            |                       |
  |80         |            |                       |
  +-----------+            |                       |
  |3f         |            |                       |
  +-----------+------------+-----------------------+
  |73         |s           |attribute              |
  +-----------+------------+name:                  |
  |63         |c           |``screenWindowCenter`` |
  +-----------+------------+                       |
  |72         |r           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |6e         |n           |                       |
  +-----------+------------+                       |
  |57         |W           |                       |
  +-----------+------------+                       |
  |69         |i           |                       |
  +-----------+------------+                       |
  |6e         |n           |                       |
  +-----------+------------+                       |
  |64         |d           |                       |
  +-----------+------------+                       |
  |6f         |o           |                       |
  +-----------+------------+                       |
  |77         |w           |                       |
  +-----------+------------+                       |
  |43         |C           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |6e         |n           |                       |
  +-----------+------------+                       |
  |74         |t           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |72         |r           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |76         |v           |attribute              |
  +-----------+------------+type:``v2f``           |
  |32         |2           |                       |
  +-----------+------------+                       |
  |66         |f           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |08         |8           |attribute              |
  +-----------+            |size                   |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |00         |0.0         |attribute              |
  +-----------+            |value:                 |
  |00         |            |v2f(0.0, 0.0)          |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+                       |
  |00         |0.0         |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |73         |s           |attribute              |
  +-----------+------------+name:                  |
  |63         |c           |``screenWindowWidth``  |
  +-----------+------------+                       |
  |72         |r           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |65         |e           |                       |
  +-----------+------------+                       |
  |6e         |n           |                       |
  +-----------+------------+                       |
  |57         |W           |                       |
  +-----------+------------+                       |
  |69         |i           |                       |
  +-----------+------------+                       |
  |6e         |n           |                       |
  +-----------+------------+                       |
  |64         |d           |                       |
  +-----------+------------+                       |
  |6f         |o           |                       |
  +-----------+------------+                       |
  |77         |w           |                       |
  +-----------+------------+                       |
  |57         |W           |                       |
  +-----------+------------+                       |
  |69         |i           |                       |
  +-----------+------------+                       |
  |64         |d           |                       |
  +-----------+------------+                       |
  |74         |t           |                       |
  +-----------+------------+                       |
  |68         |h           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |66         |f           |attribute              |
  +-----------+------------+type: ``float``        |
  |6c         |l           |                       |
  +-----------+------------+                       |
  |6f         |o           |                       |
  +-----------+------------+                       |
  |61         |a           |                       |
  +-----------+------------+                       |
  |74         |t           |                       |
  +-----------+------------+                       |
  |00         |\\0         |                       |
  +-----------+------------+-----------------------+
  |04         |4           |size                   |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |00         |1.0         |attribute              |
  +-----------+            |value                  |
  |00         |            |                       |
  +-----------+            |                       |
  |80         |            |                       |
  +-----------+            |                       |
  |3f         |            |                       |
  +-----------+------------+-----------------------+
  |00         |\\0 - end of header                 |
  +-----------+------------+-----------------------+
  |End of header                                   |
  +-----------+------------+-----------------------+
  |Start of scan line offset table                 |
  +-----------+------------+-----------------------+
  |3f         |319         |offset of              |
  +-----------+            |scan line 0            |
  |01         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |5f         |351         |offset of              |
  +-----------+            |scan line 1            |
  |01         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |7f         |383         |offset of              |
  +-----------+            |scan line 2            |
  |01         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |End of scan line offset table                   |
  +-----------+------------+-----------------------+
  |00         |0           |y scan line 0          |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |18         |24          |pixel data             |
  +-----------+            |size                   |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |00         |0.000       |pixel data             |
  +-----------+            |for G                  |
  |00         |            |channel                |
  +-----------+------------+                       +
  |54         |0.042       |                       |
  +-----------+            |                       |
  |29         |            |                       |
  +-----------+------------+                       +
  |d5         |0.365       |                       |
  +-----------+            |                       |
  |35         |            |                       |
  +-----------+------------+                       +
  |e8         |0.092       |                       |
  +-----------+            |                       |
  |2d         |            |                       |
  +-----------+------------+-----------------------+
  |5c         |0.000985395 |pixel data             |
  +-----------+            |for Z                  |
  |28         |            |channel                |
  +-----------+            |                       |
  |81         |            |                       |
  +-----------+            |                       |
  |3a         |            |                       |
  +-----------+------------+                       |
  |cf         |0.176643    |                       |
  +-----------+            |                       |
  |e1         |            |                       |
  +-----------+            |                       |
  |34         |            |                       |
  +-----------+            |                       |
  |3e         |            |                       |
  +-----------+------------+                       +
  |8b         |0.0913306   |                       |
  +-----------+            |                       |
  |0b         |            |                       |
  +-----------+            |                       |
  |bb         |            |                       |
  +-----------+            |                       |
  |3d         |            |                       |
  +-----------+------------+                       +
  |89         |0.487217    |                       |
  +-----------+            |                       |
  |74         |            |                       |
  +-----------+            |                       |
  |f9         |            |                       |
  +-----------+            |                       |
  |3e         |            |                       |
  +-----------+------------+-----------------------+
  |01         |1           |y scan line 1          |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |18         |24          |pixel data             |
  +-----------+            |size                   |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |37         |0.527       |pixel data             |
  +-----------+            |for G                  |
  |38         |            |channel                |
  +-----------+------------+                       +
  |76         |0.233       |                       |
  +-----------+            |                       |
  |33         |            |                       |
  +-----------+------------+                       +
  |74         |0.932       |                       |
  +-----------+            |                       |
  |3b         |            |                       |
  +-----------+------------+                       +
  |73         |0.556       |                       |
  +-----------+            |                       |
  |38         |            |                       |
  +-----------+------------+-----------------------+
  |7f         |0.454433    |pixel data             |
  +-----------+            |for Z                  |
  |ab         |            |channel                |
  +-----------+            |                       |
  |e8         |            |                       |
  +-----------+            |                       |
  |3e         |            |                       |
  +-----------+------------+                       |
  |8a         |0.831292    |                       |
  +-----------+            |                       |
  |cf         |            |                       |
  +-----------+            |                       |
  |54         |            |                       |
  +-----------+            |                       |
  |3f         |            |                       |
  +-----------+------------+                       +
  |5b         |0.56806     |                       |
  +-----------+            |                       |
  |6c         |            |                       |
  +-----------+            |                       |
  |11         |            |                       |
  +-----------+            |                       |
  |3f         |            |                       |
  +-----------+------------+                       +
  |20         |0.0508319   |                       |
  +-----------+            |                       |
  |35         |            |                       |
  +-----------+            |                       |
  |50         |            |                       |
  +-----------+            |                       |
  |3d         |            |                       |
  +-----------+------------+-----------------------+
  |02         |2           |y scan line 2          |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |18         |24          |pixel data             |
  +-----------+            |size                   |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+            |                       |
  |00         |            |                       |
  +-----------+------------+-----------------------+
  |23         |0.767       |pixel data             |
  +-----------+            |for G                  |
  |3a         |            |channel                |
  +-----------+------------+                       +
  |0a         |0.252       |                       |
  +-----------+            |                       |
  |34         |            |                       |
  +-----------+------------+                       +
  |02         |0.876       |                       |
  +-----------+            |                       |
  |3b         |            |                       |
  +-----------+------------+                       +
  |5d         |0.920       |                       |
  +-----------+            |                       |
  |3b         |            |                       |
  +-----------+------------+-----------------------+
  |38         |0.0189148   |pixel data             |
  +-----------+            |for Z                  |
  |f3         |            |channel                |
  +-----------+            |                       |
  |9a         |            |                       |
  +-----------+            |                       |
  |3c         |            |                       |
  +-----------+------------+                       |
  |4d         |0.298197    |                       |
  +-----------+            |                       |
  |ad         |            |                       |
  +-----------+            |                       |
  |98         |            |                       |
  +-----------+            |                       |
  |3e         |            |                       |
  +-----------+------------+                       | 
  |1c         |0.531557    |                       |
  +-----------+            |                       |
  |14         |            |                       |
  +-----------+            |                       |
  |08         |            |                       |
  +-----------+            |                       |
  |3f         |            |                       |
  +-----------+------------+                       |
  |4c         |0.515431    |                       |
  +-----------+            |                       |
  |f3         |            |                       |
  +-----------+            |                       |
  |03         |            |                       |
  +-----------+            +                       |
  |3f         |            |                       |
  +-----------+------------+-----------------------+
  |End of file                                     |
  +-----------+------------+-----------------------+