@@ -120,28 +120,28 @@ def to_png(self, data, output):
120120
121121 p__ = pack
122122 line = self .width * 3
123- png_filter = p__ (b '>B' , 0 )
123+ png_filter = p__ ('>B' , 0 )
124124 scanlines = b'' .join (
125125 [png_filter + data [y * line :y * line + line ]
126126 for y in range (self .height )])
127127
128- magic = p__ (b '>8B' , 137 , 80 , 78 , 71 , 13 , 10 , 26 , 10 )
128+ magic = p__ ('>8B' , 137 , 80 , 78 , 71 , 13 , 10 , 26 , 10 )
129129
130130 # Header: size, marker, data, CRC32
131131 ihdr = [b'' , b'IHDR' , b'' , b'' ]
132- ihdr [2 ] = p__ (b '>2I5B' , self .width , self .height , 8 , 2 , 0 , 0 , 0 )
133- ihdr [3 ] = p__ (b '>I' , crc32 (b'' .join (ihdr [1 :3 ])) & 0xffffffff )
134- ihdr [0 ] = p__ (b '>I' , len (ihdr [2 ]))
132+ ihdr [2 ] = p__ ('>2I5B' , self .width , self .height , 8 , 2 , 0 , 0 , 0 )
133+ ihdr [3 ] = p__ ('>I' , crc32 (b'' .join (ihdr [1 :3 ])) & 0xffffffff )
134+ ihdr [0 ] = p__ ('>I' , len (ihdr [2 ]))
135135
136136 # Data: size, marker, data, CRC32
137137 idat = [b'' , b'IDAT' , compress (scanlines ), b'' ]
138- idat [3 ] = p__ (b '>I' , crc32 (b'' .join (idat [1 :3 ])) & 0xffffffff )
139- idat [0 ] = p__ (b '>I' , len (idat [2 ]))
138+ idat [3 ] = p__ ('>I' , crc32 (b'' .join (idat [1 :3 ])) & 0xffffffff )
139+ idat [0 ] = p__ ('>I' , len (idat [2 ]))
140140
141141 # Footer: size, marker, None, CRC32
142142 iend = [b'' , b'IEND' , b'' , b'' ]
143- iend [3 ] = p__ (b '>I' , crc32 (iend [1 ]) & 0xffffffff )
144- iend [0 ] = p__ (b '>I' , len (iend [2 ]))
143+ iend [3 ] = p__ ('>I' , crc32 (iend [1 ]) & 0xffffffff )
144+ iend [0 ] = p__ ('>I' , len (iend [2 ]))
145145
146146 with open (output , 'wb' ) as fileh :
147147 fileh .write (magic )
0 commit comments