如何跳过压缩一个PNG? [英] How can I skip compressing one PNG?

查看:167
本文介绍了如何跳过压缩一个PNG?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(注意:我已经解决了这个问题,但这花了足够长的时间,我在这里张贴问题/答案。)



Xcode构建过程在构建时优化我的PNG。这通常不是一个问题,但iTunesArtwork正在处理这种方式会导致腐败它,使iTunes无法显示它。

解决方案

您可以在这里阅读有关Xcode的PNG压缩的更多信息:
http://iphonedevelopment.blogspot.com/2008/10/iphone-optimized-pngs.html



虽然您可以在项目设置中完全使用Compress PNG Files关闭PNG优化/压缩(只有在设置项目的Base SDK时才可见)到设备SDK,而不是模拟器SDK),你不想这样做!阅读上面的链接,了解为什么,但它的要点是,优化让iPhone跳过一些减慢PNG显示的数学。



Xcode只会优化PNG它知道的图像文件。


  1. 要阻止特定PNG被优化,请更改其文件类型,以使Xcode不再知道它是PNG。

  2. 在常规选项卡上,从 image.png中更改文件类型 $ 默认情况下,当你添加一个没有扩展名的文件,这可能是为什么iTunesArtwork没有一个,但如果你像我一样,你检查了文件类型设置,并修复它。)


    (Note: I have solved this problem, but it took long enough that I'm posting question/answer here.)

    The Xcode build process "optimizes" my PNGs when building. This isn't usually a problem, but iTunesArtwork being processed in this way causes corrupts it so that iTunes not to be able to show it. How can I prevent this?

    解决方案

    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.)

    这篇关于如何跳过压缩一个PNG?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆