How can I skip compressing one PNG?

删除回忆录丶 提交于 2019-11-27 01:45:45

You can read more about Xcode's PNG compression here: http://iphonedevelopment.blogspot.com/2008/10/iphone-optimized-pngs.html

While you can turn off PNG optimization/compression entirely using "Compress PNG Files" in your project settings (it's visible only if the project's Base SDK is set to a device SDK, not a simulator SDK), you don't want to do this! Read the link above for details on why, but the gist of it is that the optimization lets the iPhone skip some math that slows down PNG display.

Xcode will only optimize PNG image files that it knows about. To prevent a specific PNG from being optimized, you change its file type so Xcode no longer knows it's a PNG.

  1. Select the file in the project window.
  2. Choose File->Get Info.
  3. On the General tab, change File Type from image.png to file.

(This is actually the default when you add a file without an extension, which is presumably why iTunesArtwork doesn't have one. But if you're pedantic like me you checked the File Type setting and fixed it.)

Found another very simple method to disable compression for a single png file. I think this is a better approach than the accepted answer because you don't have to change type (or extension) of file in the local file-system but only in XCode.

Change the file type from Default - PNG Image to Data in Identity and Type inspector in XCode. See below:

Was:

Now:

For all you guys using Xcode 6.4 and above:

Go to: "Targets" - "YourProject Name".

Next go to the "Build Settings" tab. Just below the Tab name click the "Basic" and "Combined" Button.

Next scroll down to the "Packaging" seperator and you will find "Compress PNG Files" set to "Yes" by default.

1.Goto your build setting 
2.Search flag Compress PNG files and set it to NO.(default is YES).

After this compression of PNG images will be avoided. Just For more info

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!