6 f = open(sys.argv[1], 'rb')
11 print('Little-endian')
13 elif magic == b'SDPX':
17 print('Unrecognised magic word', file=sys.stderr)
23 im['number_elements'],
24 im['pixels_per_line'],
25 im['lines_per_element'],
33 im['colorimetric']) = struct.unpack('%shhiiiififBBB' % endian, image[0:35])
35 transfer = { 0: 'user-defined', 1: 'printing density', 2: 'linear', 3: 'logarithmic', 4: 'unspecified video', 5: 'SMPTE 240M', 6: 'CCIR 709-1', 7: 'CCIR601-2 system B or G',
36 8: 'CCIR 601-2 system M', 9: 'NTSC composite video', 10: 'PAL composite video', 11: 'Z linear', 12: 'Z homogeneous' }
38 for k, v in im.items():
41 print('%s: %s' % (k, v))