[英]Do we really need separate thumbnail images?
I understand the use of thumbnail in network applications but assuming all the image are in the application itself (photo application), in this case do we still need thumbnail images for performance reasons or is it just fine for the device to resize the actual image on run time? 我了解网络应用程序中缩略图的用法,但假设所有图像都在应用程序本身(照片应用程序)中,在这种情况下,出于性能原因还是仍然需要缩略图图像,还是设备在其上调整实际图像的大小就可以了运行?
Since the question is too opinion based I am going to ask more quantitively. 由于问题也是基于观点的,因此我将更定量地提出问题。
Will the application in this case need separate thumbnail images? 在这种情况下,应用程序是否需要单独的缩略图?
It depends on your application. 这取决于您的应用程序。 Just test performance and memory usage on device.
只需测试设备上的性能和内存使用情况即可。
If you show a lot of images and/or they change very quickly (like when you are scrolling UITableView with a lot of images) you will probably have to use thumbnails. 如果显示很多图像和/或它们变化非常快(例如,当您滚动带有许多图像的UITableView时),您可能必须使用缩略图。
UPDATE: 更新:
When image is shown it takes width * height * 3
( width * height * 4
for images with ALPHA channel) bytes of memory. 当显示图像时,它占用了
width * height * 3
(带ALPHA通道的图像的width * height * 4
)字节的内存。 10 photos 2592 x 1936 stored in memory will require 200Mb of RAM. 存储在内存中的10张照片2592 x 1936将需要200Mb的RAM。 It is too much.
实在是太多了。 You definitely have to use thumbnails.
您绝对必须使用缩略图。
Your question is a bit lacking on detail but I assume you're asking if, for say a photo album app, can you just throw around full size UIImages and let a UIImageView resize them to fit on the screen, or do you need to resize? 您的问题有点细节上的不足,但是我想您是在问,例如,相册应用程序是否可以只放入全尺寸的UIImage,然后让UIImageView调整其大小以适合屏幕大小,还是需要调整大小? ?
You absolutely need to resize. 您绝对需要调整大小。
An image taken by an iPhone camera will be several megabytes in compressed file size, more in actual bytes used to represent pixels. iPhone相机拍摄的图像的压缩文件大小为几兆字节,而用于表示像素的实际字节更多。 The dimensions of the image will be far greater than the screen dimensions of the device.
图像的尺寸将远远大于设备的屏幕尺寸。 The memory use is very high, particularly if you're thinking of showing multiple "thumbnails".
内存使用率很高,尤其是当您考虑显示多个“缩略图”时。 It's not so much a CPU issue (once the image has been rendered it doesn't need re-rendering) but a memory one, and you're severely memory constrained on a mobile device.
这不是CPU问题(一旦渲染了图像就不需要重新渲染),而是一个内存问题,而您在移动设备上的内存严重受到限制。
Each doubling in size of an image (eg from a 100x100 to a 200x200) represents a four-fold increase in the memory needed to hold it. 图像大小每增加一倍(例如,从100x100到200x200)代表保存图像所需的内存增加了四倍。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.