Xcode炸毁PNG大小并忽略压缩PNG = NO标志? [英] Xcode blowing up PNG size and ignoring Compress PNG = NO flag?

查看:320
本文介绍了Xcode炸毁PNG大小并忽略压缩PNG = NO标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我的Assets.xcassets文件夹大约为13MB,包含我的应用程序的所有图像。但是,当我存档我的应​​用程序时,Assets.car的结果更接近33MB。当使用如下所述的iOSAssetExtractor时:什么有助于IOS应用程序中的资产大小?我如何缩小它?问题似乎是PNG在被压缩时正在大大增加通过Xcode。在完成归档过程之前,许多PNG的大小是它们的2-3倍。这是在多个地方引用的常见问题。

Currently, my Assets.xcassets folder is ~13MB with all images for my application. However, when I archive my app the Assets.car that results is closer to 33MB. When using iOSAssetExtractor as described here: What contributes to the size of assets in an IOS App and how can I shrink this? the issue appears to be that the PNGs are blowing up in size when they are "compressed" by Xcode. Many PNGs are 2-3x the size they were before going through the archiving process. This is a common problem that is referenced in multiple places.

此处引用的常用解决方案: XCode png压缩问题,此处: https:// imageoptim .com / xcode.html 似乎在构建设置中将压缩PNG文件设置为否。这会跳过Xcode的资产拆包和重新压缩,以避免可能遇到的资产规模膨胀。但是,这似乎目前没有工作,可能已停止在Xcode 7.3中工作。这里的Apple论坛有一个主题: https://forums.developer.apple。 com / thread / 43372 。但是,接受的解决方案似乎是将检查器中的文件类型更改为适用于资源文件夹中的PNG的数据,但似乎不是存储在xcassets文件夹中的PNG的选项。

The usual solution as referenced here: XCode png compression issue and here: https://imageoptim.com/xcode.html appears to be setting "Compress PNG Files" to No in build settings. This skips Xcode's unpacking and recompression of assets to avoid the asset size bloat that can be experienced. However, this doesn't appear to be working currently and might have stopped working in Xcode 7.3. There is a thread on this in the Apple forums here: https://forums.developer.apple.com/thread/43372 . However, the accepted solution appears to be changing the file type in the inspector to data which works for PNGs in a resources folder but does not appear to be an option for PNGs stored in an xcassets folder.

注意:我也尝试过设置从PNG文件中删除文本元数据,但没有成功。

Note: I've also tried setting "Remove Text Metadata from PNG Files" to no as well with no success.

任何人都可以推荐解决方案如何在当前(7.3)版本的Xcode中修复此问题,以便我的Assets.car文件最终不会比预期的大2-3倍?

Can anyone recommend a solution for how to fix this issue in the current (7.3) version of Xcode so that my Assets.car file does not end up 2-3x larger than expected?

推荐答案

PNG尺寸越来越大的具体问题似乎是Apple漏洞,现在似乎已得到解决。但是,将每个PNG缩小到最小可能尺寸的更普遍的问题仍然可以更有效地解决。如果您有兴趣阅读新的交付编解码器,可以挤出每个PNG的最后一个字节,那么请看看这个iOS框架。

The specific problem of PNG sizes getting much larger seems to have been an Apple bug which appears to be addressed now. But, the more general problem of shrinking down each PNG to the smallest possible size is something that can still be solved more effectively. If you are interested in reading about a new delivery codec that can squeeze every last byte out of each PNG, then please have a look at this iOS framework.

这篇关于Xcode炸毁PNG大小并忽略压缩PNG = NO标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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