From e0e902b1c7612a582a945fd4b0bb31e3b19d5945 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Mon, 18 Mar 2013 04:52:49 -0500 Subject: [PATCH] dump tileset pngs in gfx.py --- extras/gfx.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/extras/gfx.py b/extras/gfx.py index 3aa98b3ca..c2307a686 100644 --- a/extras/gfx.py +++ b/extras/gfx.py @@ -1492,8 +1492,25 @@ def append_terminator_to_lzs(directory): new.write(data) new.close() +def lz_to_png_by_file(filename): + """ + Converts a lz file to png. Dumps a 2bpp file too. + """ + assert filename[-3:] == ".lz" + lz_data = open(filename, "rb").read() + bpp = Decompressed(lz).output + bpp_filename = filename.replace(".lz", ".2bpp") + to_file(bpp_filename, bpp) + to_png(bpp_filename) - +def dump_tileset_pngs(): + """ + Converts .lz format tilesets into .png format tilesets. Also, leaves a + bunch of wonderful .2bpp files everywhere for your amusement. + """ + for tileset_id in range(37): + tileset_filename = "../gfx/tilesets/" + str(tileset_id).zfill(2) + ".lz" + lz_to_png_by_file(tileset_filename) if __name__ == "__main__": parser = argparse.ArgumentParser()