Last active
December 31, 2015 07:39
-
-
Save crosslife/7955300 to your computer and use it in GitHub Desktop.
convert pzd to png
This file contains 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
import os | |
def convertPzdToPng(fileName): | |
pzdBinFile =open(fileName,'rb') | |
pzdSize = os.path.getsize(fileName) | |
pngSize = pzdSize - 33 | |
pzdBinFile.read(32) | |
outFileName = "outTexture\\" + fileName.split("\\")[-1][0:-4] + ".png" | |
pngFile =open(outFileName,"wb") | |
pngFile.write(pzdBinFile.read(pngSize)) | |
pngFile.close() | |
print("converted " + fileName + " ...") | |
def visitPzd(rootDir): | |
list_dirs = os.walk(rootDir) | |
for root, dirs, files in list_dirs: | |
for f in files: | |
fileFullName = os.path.join(root, f) | |
if fileFullName.endswith(".pzd"): | |
convertPzdToPng(fileFullName) | |
if __name__ == '__main__': | |
os.mkdir("outTexture") | |
visitPzd(".") | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment