如果我的 iPad 应用程序包含大量图像,PNG 仍然是最佳选择吗?

发布于 2024-10-04 11:19:32 字数 385 浏览 6 评论 0原文

我正在开发一个 iPad 应用程序,其中包含数百张照片质量的图像。我自然会假设将这些图像存储为 JPEG,以便优化应用程序文件大小。然而,苹果的指导方针指出:

图像使用 PNG 格式。 PNG 格式提供无损图像内容,这意味着将图像数据保存为 PNG 格式然后读回会产生完全相同的像素值。 PNG 还具有优化的存储格式,旨在更快地读取图像数据。它是 iOS 的首选图像格式。

但是,如果我以 100% 质量将相同的图像存储为 JPEG,它们的大小会下降到 PNG 无损版本的一半左右。

使用 JPEG 代替 PNG 真的会对性能造成那么大的影响吗?如果我以轮播或画廊风格查看这些图像,我真的需要担心性能并使用 PNG 来代替吗?

谢谢!

I am working on an iPad application which has hundreds of photo-quality images. I would have naturally assumed to store these images as JPEGs so as to optimize the app file size. However, Apple's guidelines state:

Use the PNG format for images. The PNG format provides lossless image content, meaning that saving image data to a PNG format and then reading it back results in the exact same pixel values. PNG also has an optimized storage format designed for faster reading of the image data. It is the preferred image format for iOS.

However, if I store the same images as JPEGs at 100% quality, the size of them drops to about half that of the PNG lossless versions.

Is there really that much of a performance hit to use JPEG instead of PNG? If I am viewing these images in a carousel or gallery style, do I really need to worry about the performance and use PNGs instead?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最单纯的乌龟 2024-10-11 11:19:32

关于质量,PNG 适合应用程序类型的图像,但 JPEG 更适合照片。选择能够为您的图像提供足够好的质量的最低 JPEG 质量。

关于速度,尺寸也很重要。我没有 iPad 来测试,但从闪存或网络读取的较小文件大小可能会远远超过任何额外的解压缩成本。找出答案的唯一方法是在您的实际设备上进行测量。

Regarding the quality PNG is good for application kind of images, but JPEG is preferred for photos. Choose the lowest JPEG quality that gives good enough quality for your images.

Regarding speed, size also matters. I have no IPad to test with, but the smaller file size to read from flash or network might very well out weight any additional decompression cost. The only way to find out is to measure on your actual device.

很快妥协 2024-10-11 11:19:32

有一个性能考虑因素,但虽然 PNG 在质量上是首选,但考虑到您的应用程序,我建议 JPEG 更可取。

纯粹的性能并不是唯一令人感兴趣或关心的因素; iPad 的可用空间有限,在大多数情况下,用大多数用户不需要或不想要的图像数据填充它似乎比使用更多计算能力更好。

另一件需要考虑的事情 - 在画廊上,强烈建议您生成缩略图,这可以让您两全其美:更小、更易于访问的通用图像和“最佳”的完整原始图像。

如果有疑问,请对两者进行基准测试,看看您的应用程序中的差异有多大 - 如果相对于节省空间而言您可以忍受这种差异,请选择 JPEG。

There is a performance consideration but while PNG is preferred for quality, given your application, I'd suggest JPEG would be preferable.

Pure performance isn't the only factor of interest or concern; an iPad has only a finite space available to it, and filling that up with image data that most users are not going to need or want seems preferable to using more computational power for most cases.

One other thing to consider - on a gallery, you are strongly recommended to generate thumbnails which give you the best of both worlds: the smaller, more accessible image for general use and the full original image for 'best'.

If in doubt, benchmark with both and see how big the difference is in your application - and if the difference is something you can live with versus the space saving, go with JPEG.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文