debug map_lut image
[sparrow.git] / link_images.py
blob72b0ba0b81ff0b55b3c2acfa899a6c16d29de364
1 #!/usr/bin/python
3 import os, sys
4 import struct
5 import os, sys, re
7 from sparrow import FRAME_STRUCTURE, INDEX_FILE, TEXT_INDEX_FILE
8 from sparrow import save_frames, save_frames_text, Frame, link_frames
10 # f.write(struct.pack('II48s8I',
11 # frame.glob_index,
12 # frame.jpeg_len,
13 # frame.summary,
14 # *frame.successors
15 # ))
18 def load_frames(filename):
19 f = open(filename)
20 structlen = struct.calcsize(FRAME_STRUCTURE)
21 frames = []
22 for i in count():
23 s = f.read(structlen)
24 if not s:
25 break
26 frame = Frame(s)
27 frame.index = i
28 frames.append(frame)
30 return frames
34 frames = link_frames(load_frames(INDEX_FILE))
36 save_frames(frames, INDEX_FILE + '-new')
37 save_frames_text(frames, TEXT_INDEX_FILE + '-new')