iOS中的Png - png是捆绑vs下载 - png8 vs png24 [英] Png's in iOS - png's in bundle vs downloaded - png8 vs png24

查看:84
本文介绍了iOS中的Png - png是捆绑vs下载 - png8 vs png24的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个iOS应用程序并且有一些关于使用png和性能的问题,我找不到任何答案。

I'm writing an iOS application and have some questions about using png's and performance which I couldn't find any answers for.

我的应用程序使用pngs来自2来源,有些是在应用程序包中,其他是从Internet下载并存储在本地。应用程序包中的那些我有我的头,我知道xCode在应用程序编译时为iOS优化它们(Byte Swapping和Premultiplied Alpha)。关于从互联网上下载的png,我有以下问题。

My app uses pngs from 2 sources, some are in the app bundle, and others are downloaded from the internet and stored locally. The ones in the app bundle I have my head around, I know xCode optimizes them for iOS when the app is compiled (Byte Swapping and Premultiplied Alpha). I have the following questions about png's downloaded from the internet.

1)如果图像是下载的,那么你是否还能在iOS中使用png获得性能优势? 。可以以某种方式将xCode优化应用于下载的图像吗?

1) Do you still get the performance benefits from using pngs in iOS if the images are downloaded vs in the bundle. Can the xCode optimizations be applied to downloaded images somehow?

2)除文件大小外,使用png8 vs png24还有什么优点(或缺点)?从本地文件扩展时,它们会占用更少的内存吗?扩展它们需要花费更少的精力吗?动画是否有任何性能提升?或者是从较小的文件大小和更好的下载时间中获得的唯一收益?

2) Are there any advantages (or disadvantages) to using png8 vs png24, aside from file size? Do they take less memory when expanded from a local file? Does it take less effort to expand them? Is there any performance gain on animations? Or is the only gain from the smaller file size and better download time?

提前感谢您的任何答案。

Thanks in advance for any answers.

Paul

推荐答案


  1. PNG优化由Apple自己的<$>版本完成c $ c> pngcrush (即使其作者声明


[...] 2.修改后的版本必须明确标明,不得歪曲为原始二元或来源。( http://optimate.dl.sourceforge.net/project/pmt/pngcrush/1.7.70/pngcrush-1.7.70-HELP.txt

- 但Apple并不关心此类细节。 编译源时,XCode会调用 pngcrush 。编译后,XCode与以后下载的图像无关。但是,您可以在上传之前应用Apple的 pngcrush 来优化新图像。在我看来,这是否值得努力是值得怀疑的。

-- but Apple does not care about such details). pngcrush is called upon by XCode when compiling your source. After compilation, XCode has nothing to do anymore with later downloaded images. However, you can apply Apple's pngcrush to "optimize" the new images before uploading them. In my regard it's questionable whether or not this is worth the effort.

这取决于,连续四次。 (如果我正确计数。)8位PNG比24位PNG小3倍。使用单个字节而不是3或4(RGB,RGBA)应该更快;当然它使用更少的内存。它主要(或可能,仅)取决于您的图像的内容。使用PNG算法会严重压缩摄影图像,并且在以8位颜色索引模式保存时会受到颜色量化的影响。典型的计算机图像 - 比如文本编辑器的快照 - 具有相同颜色的大区域可以非常快速地解压缩。

It depends, four times in a row. (If I'm counting correctly.) An 8-bit PNG is 3 times smaller than a 24-bit PNG. Working with single bytes instead of 3 or 4 (RGB, RGBA) should be faster; and naturally it uses less memory. It mainly (or possibly, only) depends on the content of your images. A photographic image compresses badly with PNG's algorithms and would suffer from color quantization when saved in 8-bit color indexed mode. A typical "computer" image -- say, a snapshot of a text editor -- with large areas in the same color may decompress very fast.

如果 要使用8位PNG,则不会使用Apple修改版本适用的优化。它的主要修改是重新排列RGB(A),大概是为了与iPhone / iPad的显示器对齐。 (它的次要目的似乎是使图像无效为有效的PNG。)

If you are going to use 8-bit PNGs, the "optimizations" that Apple's modified version applies are not used. Its main modification is to re-arrange RGB(A), presumably to align to the display of an iPhone/iPad. (Its secondary purpose seems to be to invalidate the image as a valid PNG.)

这篇关于iOS中的Png - png是捆绑vs下载 - png8 vs png24的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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