Skip to content

Instantly share code, notes, and snippets.

@NWPlayer123
Created March 14, 2018 07:18
Show Gist options
  • Save NWPlayer123/e7e0c2fbb489dd07ba37ebc567dfc360 to your computer and use it in GitHub Desktop.
Save NWPlayer123/e7e0c2fbb489dd07ba37ebc567dfc360 to your computer and use it in GitHub Desktop.
for use with parse_tpl.py for Super Monkey Ball 2's Preview TPLs
from parse_tpl import *
from os import mkdir
from os.path import exists
name = "banner"
width = 96
height = 32
if not exists(name):
mkdir(name)
with open("%s%sx%s.tpl" % (name, width, height), "rb") as f:
f.seek(0, 2)
size = f.tell()
count = int(float(size) / float(width) / float(height) / 2.0)
for i in range(count):
tex = RGB5A3_Texture(width, height)
f.seek(width * height * 2 * i)
tex.DecodeImage(f)
tex.image.save("%s/img%d.png" % (name, i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment