Skip to content

Instantly share code, notes, and snippets.

@crosslife
Last active December 31, 2015 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crosslife/7955300 to your computer and use it in GitHub Desktop.
Save crosslife/7955300 to your computer and use it in GitHub Desktop.
convert pzd to png
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