响应式全屏图像而不损失质量,可能吗?
你好 stackoverflow 社区,希望你今天过得愉快 :)
开门见山: 我已经开始计划我的新作品集(顺便说一句,我是一名艺术总监)。我最初的想法不仅是让作品集响应式(我认为 1024x768px 一直到 2560x1600px),而且还通过全浏览器屏幕图像提供一些不错的作品预览。
正如你所料,我遇到了一个问题。设计为完全适合 2560x1600 像素的图像不会在不损失质量或扭曲的情况下调整为 1440x900 像素。
所以我真的可以利用你们的帮助和经验...是否有一个“完美”的图像尺寸可以完美地调整到以下分辨率:1024x768px、1280x800px、1280x1024px、1440x900px、1920x1080px、2560x1600px。有可能这样做吗?
我真的很感谢你的帮助。提前致谢 :)
Hallo community of stackoverflow, I hope you're having a nice day :)
Straight to the point :
I've started to plan on a new portfolio of mine (I am an art director bytheway). And my original idea was not to only make a portfolio responsive (I am thinking 1024x768px all the way up to 2560x1600px), but also have some nice work preview via full-browser-screen images.
And as you might expect I've encautered a problem. Image designed to fully fit 2560x1600px won't resize to lets say 1440x900px without loosing quality or being distorted.
So I could really use your help and experience guys... Is there a "perfect" image size that would resize beautifully to the following resolutions : 1024x768px, 1280x800px, 1280x1024px, 1440x900px, 1920x1080px, 2560x1600px. Is it even possible to do that ?
I really appreciate your help. Thanks in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不要尝试将整个图像缩放到所有这些不同的分辨率,而是考虑保留纵横比(宽度:高度),同时缩放到接近(但大于)所需的分辨率,然后裁剪图像。
缩放图像和更改纵横比总是会导致失真。
Rather than trying to scale the entire image to all those different resolutions, consider preserving the aspect ratio (width : height) while scaling as close to (but larger than) the required resolution, and then cropping the image.
Scaling an image and changing the aspect ratio always causes distortion.
不,不存在可以完美缩放到所有这些不同尺寸的图像,因为它们代表几种不同的形状或纵横比。将图像的宽度和高度缩放不同的量会导致图像扭曲,并且通常看起来不太好。
选项如下:
在所有情况下,您都希望分析可能的显示尺寸并选择形状与尽可能多的目标屏幕尺寸最接近的源图像。
No, there is no such thing as an image that will scale perfectly to all those different sizes because they represent several different shapes or aspect ratios. Scaling an image a different amount in width vs. height results in the image being distorted and generally does not look good.
The options are as follows:
In all cases, you want to analyze the likely display sizes and pick a source image that is closest in shape to as many target screen sizes as possible.
您可以使用 Photoshop 或任何其他软件准备许多图像,然后使用响应式设计,您将能够为不同的屏幕尺寸显示足够的图像。
这是一个仅使用 css/html 的简单技巧:
成分
具有所需比例的透明 PNG 图像
(transparent-ratio-conserver.png)
标签
不同视口的不同图像(retina.jpg、desktop.jpg、
table.jpg...)
这个想法是打开一个标签并为其分配一个透明图像(具有我们所需的比例)。我们还添加了 HTML 中的 class="responsive-image"。
在 CSS 中,我们设置背景大小以适合,并选择图像的宽度。
最后,我们为每个视口提供正确的图像:
您可以从 此处下载演示。
You can prepare many images using photoshop or any other software, then using responsive design you would be able to display the adequate image for different screen sizes.
Here is a nice and simple tip with only css/html:
Ingredients
Transparent PNG image with the desired ratio
(transparent-ratio-conserver.png)
tag
Different images for different view-ports (retina.jpg, desktop.jpg,
tablet.jpg...)
The idea is to open an tag and to assign to it a transparent image (with our desired ratio). We also add class="responsive-image" that's all in HTML.
In the CSS, we set background-size to fit the and we choose the width of our image.
and finally, we serve for every view-port the right image:
You can download the demo from here.