PNG and iOS optimization options

Source: Internet
Author: User

Each app you download from the App Store is initially an IPA file (in fact, a zip format, with a folder organized in a specific rule). However, as a zip, you will find a lot of PNG files inside, because these PNG images have been "optimized" by the iOS development tool.

Bjango.com's article mentions that regardless of the developer's prior optimizations to PNG (such as optimizing the color range), the result is the same file size-because Xcode compiles all of the PNG files to its own way.

What exactly does Apple have to do with each PNG? Why is it.

Apple's developer documentation and a variety of conferences/videos, from the very beginning, advocated as many images in PNG format as possible, saying that iOS is optimized for PNG format only. The result is the same, and the final file size is also smaller. But just to make the file size smaller is so worth saying.

Later in 10 there was a q&a document that also mentions a Xcode-included gadget Pngcrush can make "iphone-optimized png file to a standard PNG file" (mainly because of the developers asked why the PNG file can not see Ah ah).

It has also been found that the standard 24bit PNG file is stored in order (Red/green/blue/transparent) to save every pixel, that is, Rgba, and after Xcode optimized PNG file pixel order into Bgra, Such a non-standard PNG file in the general operating system will not be able to read. Apple does this for a reason, and an article in OpenGL Wiki mentions that most GPU image/texture memory is 24bit per unit, both Rgba and Bgra, but Bgra is mainstream. This makes sense: in order to reduce the time that Apple spends on data exchange (from file system to display), the principle of similar DMA is used, and the graph data can go directly in the bus without spending the time of CPU to assist processing.

This is really a big advantage, not only the size of the file will be small, but also for the iOS smooth operation of the very strong support. But the file size is also getting smaller. I don't know what else to do. Optimization processing (–_–| | |), should be some of the PNG file format optimization algorithm bar.

This PNG optimization option is a switch in the Xcode project, which can be turned off and on, by default, and no special case is recommended to open it.

After the recent system upgrade 10.7.3 brought a new bug to Xcode, I think there is some kind of association with this. In the process of submitting an iOS app to the App Store, there is a step to validate to upload, which is a bug that causes each validate not to pass. Hint icon icon.png the size of 0x0 is not compliant, but in fact this PNG is not a problem. After the search found that someone found a temporary solution is to turn compress png off, so it is OK, Xcode can be successfully submitted through validate, but this has a negative impact on file size and operational efficiency. Then someone found that reloading application loader could solve the problem.

Resources:

Http://www.opengl.org/wiki/Common_Mistakes

http://bjango.com/articles/pngcompression/

http://developer.apple.com/library/ios/#qa/qa1681/_index.html

Postscript:

After OSX10.8, the system will recognize the special PNG itself, so no matter what PNG can be displayed normally, not related to Xcode

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.