Created
          March 14, 2018 07:18 
        
      - 
      
- 
        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
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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