def png_to_lz(filein): name = os.path.splitext(filein)[0] export_png_to_2bpp(filein) image = open(name + '.2bpp', 'rb').read() to_file(name + '.2bpp' + '.lz', Compressed(image).output)
def compress_file(filein, fileout=None): image = bytearray(open(filein).read()) lz = Compressed(image) if fileout == None: fileout = filein + '.lz' to_file(fileout, lz.output)
def compress(filenames=[]): for filename in filenames: data = open(filename, 'rb').read() lz_data = Compressed(data).output to_file(filename + '.lz', lz_data)