def read_runinfo(data): info = {} reader = ByteReader(data) count = reader.readInt(True) for _ in xrange(count): name = reader.read(reader.readInt(True)) alts = {} for i in xrange(26): alts[i] = reader.readByte(True) info[name] = alts return info
def read(self, reader): self.handle = reader.readInt(True) self.checksum = reader.readInt() self.references = reader.readInt() decompressedLenght = reader.readInt() self.flags.setFlags(reader.readInt(True)) reserved = reader.readInt() nameLenght = reader.readInt() if self.settings.get('compressed', True): size = reader.readInt() data = ByteReader(zlib.decompress(reader.read(size))) else: data = reader.readReader(decompressedLenght) self.name = self.readString(data, nameLenght) self.data = data.read()
def to_png(data): reader = ByteReader(data) width = reader.readInt(True) height = reader.readInt(True) data = reader.read(width * height) return Image.frombytes('L', (width, height), data)
def to_png(data): reader = ByteReader(data) width = reader.readInt(True) height = reader.readInt(True) data = reader.read(width*height) return Image.frombytes('L', (width, height), data)