MCPcopy Create free account
hub / github.com/ActiveState/code / Find_Chunks

Method Find_Chunks

recipes/Python/578534_parse_png_image/recipe-578534.py:32–49  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

30 return vals
31
32 def Find_Chunks(self):
33
34 x=Chunk()
35 total=0
36 while x.type != 'IEND':
37 x=Chunk()
38 x.Length=int(''.join(self.data[8+total:12+total]),16)
39 x.type=''.join(self.data[12+total:16+total]).decode('hex')
40
41 x.data=''.join(self.data[16+total:15+x.Length+total])
42 x.CRC=''.join(self.data[16+x.Length+total:20+x.Length+total])
43 w=x.hight_width()
44 if w:
45 self.width=w[0]
46 self.hight=w[1]
47 self.Chunks.append(x)
48
49 total=total+x.Length+12
50
51
52 def __init__(self,file):

Callers 1

__init__Method · 0.95

Calls 5

hight_widthMethod · 0.95
ChunkClass · 0.70
joinMethod · 0.45
decodeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected