Viewing iPhone-Optimized PNGs
Q: When I build my iPhone OS application, Xcode optimizes the PNG files within my application's bundle, meaning that Preview can't display them. How can I view these optimized files?
A: When I build my iPhone OS application, Xcode optimizes the PNG files within my application's bundle, meaning that Preview can't display them. How can I view these optimized files?
This optimization is done by the pngcrush
tool, which you can find in /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush
(assuming you installed the iPhone SDK in the standard place). In iPhone SDK 3.2 and later, the pngcrush
tool supports a command line option, -revert-iphone-optimizations
, that undoes the optimizations done during the Xcode build process. So, to view an optimized PNG file, you should first undo the optimization and then open it with Preview.
Listing 1 shows how you can use the pngcrush
tool to convert an iPhone-optimized PNG file (Local.png
) to a standard PNG file (Local-standard.png
).
Listing 1 Undoing iPhone PNG optimization
$ /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush \ -revert-iphone-optimizations -q Local.png Local-standard.png |
批量将优化后的PNG文件转换为正常可预览的PNG文件:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -revert-iphone-optimizations -d outdir *.png
南来地,北往的,上班的,下岗的,走过路过不要错过!
======================个性签名=====================
之前认为Apple 的iOS 设计的要比 Android 稳定,我错了吗?
下载的许多客户端程序/游戏程序,经常会Crash,是程序写的不好(内存泄漏?刚启动也会吗?)还是iOS本身的不稳定!!!
如果在Android手机中可以简单联接到ddms,就可以查看系统log,很容易看到程序为什么出错,在iPhone中如何得知呢?试试Organizer吧,分析一下Device logs,也许有用.