ios纹理压缩


问题:PVRTC质量实在不行啊,谁有个好的推荐

//TEMP 

http://www.uchidacoonga.com/2011/07/pvrtc-textures-and-cocos2d/

http://www.imgtec.com/forum/forum_posts.asp?TID=576&title=pvr-problem-with-the-border-of-transparent-images

http://www.cocos2d-iphone.org/forum/topic/11252

http://wiki.sparrow-framework.org/tutorials/pvr_textures

http://www.cocos2d-iphone.org/forum/topic/9428

http://www.imgtec.com/powervr/insider/docs/PVRTCTexture%20Compression.User%20Guide.pdf


总结:

1.TextureTool

命令行生成pvr,生成的质量较差。

    

#转换png->pvr
    texturetool = "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool"
    texturetoolcmd = "%s -e PVRTC --bits-per-pixel-4 -o %s -f PVR %s" %(texturetool,"tmp.pvr","tmp.png")
    os.system(texturetoolcmd)

2.PVRTexTool

下载安装最新的PVRTexTool 我安装的是3.40版本,每个版本的命令参数差异较大.

    #转换png->pvr
    texturetool = "./PVRTexToolCL"
    texturetoolcmd = "%s -f PVRTC1_4 -q pvrtcbest -legacypvr -l -i %s -o %s" %(texturetool,"tmp.png","tmp.pvr")
    os.system(texturetoolcmd)

以上的命令参数是经过多次测试出来,效果最好的,不过生成的时间比较长。大量生成时可以做一个机制只生成变动的图片。


pvr过大时可以考虑压缩成pvr.ccz pvr.gz

    #TODO
    #gzip压缩 能省不少大小 520K -> 150K
    gzipcmd = "gzip %s" %(outfile)
    os.system(gzipcmd)
    loginfo("gzip")



你可能感兴趣的:(ios)