ios – 如何将图像转换为PVRTC格式

我一直在使用终端将名为left的jpg图像转换为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回到你的root并运行工具,如:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool -e PVRTC –bits-per-pixel-2 -f PVR -o [pvr去的新路径] [原来的路径]

您的输出pvr路径可以是〜/ whatever / image.pvr,输入png是要转换的图像的路径.

HEREHERE是其他很好的演练

The iPhone SDK includes a tool that allows you to create textures in the PVRTC compression format, aptly named texturetool. If you have Xcode installed with the iPhone OS 2.2 SDK in the default location (/Developer/Platforms/), then texturetool is located at: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool.

texturetool allows you to create four variants of PVRTC data, the primary difference being tradeoffs between quality and size. You will have to experiment with these variants to determine which setting is the best compromise for each individual texture image.

> Apple Docs

HERE是一些相同的代码,一旦你有了你的pvrtc文件就可以提供帮助

HERE是一些更多的文档

HERE是关于PVRTC的好东西

点赞