Viewing iOS-Optimized PNGs
Q: When I build my iOS 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: This optimization is done by the pngcrush
tool, which you can find inside Xcode. 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 iOS-optimized PNG file (Local.png
) to a standard PNG file (Local-standard.png
). It uses xcrun to run the tool from within your currently selected Xcode (as determined by xcode-select).
Listing 1 Undoing iOS PNG optimization
$ xcrun -sdk iphoneos pngcrush \ |
-revert-iphone-optimizations -q Local.png Local-standard.png |
Document Revision History
Date | Notes |
---|---|
2013-08-13 | Updated to use xcrun (r. 13698179). |
2012-05-16 | Updated to account for Xcode being packaged as an application (r. 11396673). |
2010-04-09 | New document that explains how you can view a PNG file that's been optimized for iOS by the pngcrush tool. |
Copyright © 2013 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2013-08-13