我一直在使用终端将jpg
名为 left 的图像转换为pvrtc
格式,这发生了:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool -e PVRTC --bits-per-pixel-2 -o left.pvrtc left.jpg
Failed to load image
Failed to perform Encode
改变:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool -e PVRTC --bits-per-pixel-2 -o left.pvrtc left.jpg
至:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool -e PVRTC --bits-per-pixel-2 -o left.pvr left.PNG
文件必须是 PNG
更新了 OSX 10.10+ 的说明
在终端中,点击cd
以确保您位于根目录中。
cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ && ls
这应该会向您显示所有工具的列表(确保您看到texturetool
) - 如果没有,请更新您的操作系统,然后更新 Xcode
一旦你知道它在那里,cd
回到你的根目录并运行这个工具,比如:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool -e PVRTC --bits-per-pixel-2 -f PVR -o [new path to pvr to go] [path of original png]
您的输出 pvr
路径可以是~/whatever/image.pvr
,您的输入是 要png
转换的图像的路径。
其中
iPhone SDK
包括一个工具,可让您以 PVRTC 压缩格式创建纹理,恰当地命名为texturetool
. 如果您在默认位置 (/Developer/Platforms/) 中安装了 Xcode 和 iPhone OS 2.2 SDK,则texturetool
位于:/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool
.
texturetool
允许您创建四种PVRTC
数据变体,主要区别在于质量和大小之间的权衡。您将不得不对这些变体进行试验,以确定哪种设置是每个单独纹理图像的最佳折衷方案。
pvrtc
有了文件后,这里有一些相同的代码可以提供帮助
这里还有一些文档
这里PVRTC
是关于东西的好读物