CCZ——python压缩纹理成ccz
python压缩纹理资源 ===> ccz
import os import struct import zlib def ccz(inputFile, outputFile, width, height): if not os.path.exists(inputFile): print("########: !!! error: " + inputFile) # orgin file to ccz size = os.path.getsize(inputFile) inputData = open(inputFile, "rb").read(size) outcczWriter = open(outputFile, "wb") outcczWriter.write(struct.pack(">4sHHII", "CCZ!", 0, 1, 0, size)) outcczWriter.write(zlib.compress(inputData)) outcczWriter.close() # os.remove(oriFile) print("gen ccz file => " + outputFile)