简体   繁体   English

我们真的需要单独的缩略图吗?

[英]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. 由于问题也是基于观点的,因此我将更定量地提出问题。

  • The images are 500x500, about 200-300kb size jpg. 图片为500x500,约200-300kb大小的jpg。
  • There will be about 200 images. 大约有200张图像。
  • It is targeted for iphone4 and higher, so that would be the minimum hardware specs users will have. 它面向iphone4及更高版本,因此这将是用户拥有的最低硬件规格。
  • The maximum memory used should not pass 20% of the devices capacity. 使用的最大内存不应超过设备容量的20%。

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.

相关问题 我们真的需要以性能的名义从 devDependencies 中剥离包吗? - Do we really need to strip packages from devDependencies in the name of performance? Android:我们真的需要设置在运行时(动态)创建的视图ID吗? - Android: Do we really need to set id for view, which is created at RunTime(Dynamically) ? fsnotify真的需要全局列表扫描吗? - Do fsnotify really need global list scan? 我真的需要在动态壁纸的渲染循环中在SurfaceHolder上进行同步 - Do I really need to synchronize on SurfaceHolder in a rendering loop of a live wallpaper 静态图片加载速度非常慢 - Static images loads really slow 我们是否需要使用MappedByteBuffer.force()将数据刷新到磁盘? - Do we need to use MappedByteBuffer.force() to flush data to disk? 为什么在使用statsd时我们需要telegraf - Why do we need telegraf when using statsd 为什么在使用Vtune进行分析的过程中需要调试信息? - Why do we need debug information during profiling using Vtune? 如果我们为每个ABI上传不同的apk,我们是否需要上传universal-apk - Do we need to upload universal-apk if we are uploading different apk's for each ABI 当存在与列表链接的单独链接时,为什么我们在哈希表中使用线性探测? - Why do we use linear probing in hash tables when there is separate chaining linked with lists?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM