为什么有多种图像尺寸
我试图理解具有多种图像尺寸的原因。我知道有不同尺寸和不同密度的屏幕,但是只拥有最大分辨率的图像并将其加载到您需要的尺寸而不是拥有大量不同的图像不是可以接受的吗?
I am trying to understand the reason for having multiple image sizes. I know there are different size screens with different densities, but wouldn't it be acceptable to just have the largest resolution image and load it to the size you need rather than have lots of different images?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
缩放图像比仅加载预渲染图像需要更多的处理能力。此外,与一开始就以正确尺寸正确渲染的算法相比,天真的/简单的图像缩放算法看起来质量相当低。
Scaling an image takes considerably more processing power than just loading a pre-rendered one. Also, a naive/simple image scaling algorithm would look pretty low quality compared to one that had been actually properly rendered at the right size in the first place.
我想你可以,但是
You could, I suppose, but what about
你说得对,这是可以接受的。
与往常一样,这只是以速度换取磁盘空间。
您决定是增加尺寸还是在运行时调整图形大小……这取决于您的用例。
You are right it is acceptable.
As always this is just about trading speed for disk space.
You decide if you increase the size or have your graphics resize at runtime... it depends on your usecase.
这是因为您不必一遍又一遍地处理长文件,想象一下您网站上的许多访问者都请求相同的图像,他们具有不同的分辨率,最好使用不同的图像,而不是处理最大的图像每个请求都会有一个新请求,这是因为服务器端的性能以及您站点中的重要并发性,这可能会给堆空间带来问题,您必须关心数据处理性能。有时您必须在堆空间、处理器和数据空间资源之间进行选择。
It is because you do not have to be processiing a long file over and over again, imagine lots of visitors onto your site all of them requesting the same image they have different resolutions is better to have different images instead being processing the largest image to have a new one for each request, this is because of performance on the server side with an important concurrency in your site this may carry issues for the Heap Space you must care about data process performance. some times you have to choose in between resources Heap Space, Processor and DataSpace.