较大图像文件中的质量更好的缩略图
我将其他网站的图像显示为缩略图。 为此,我将它们显示在较小的 img 标签中,以便浏览器减小尺寸。
问题是这些图像的质量(我无法控制)下降了。 而且它们在 FF 和 Safari 中看起来比在 IE 中好得多。
有没有办法让这些图像看起来更好而不将它们缓存在我的服务器上? (例如,可以以更好的质量调整大小的 javascript 库)? 任何想法都受到高度赞赏。
I'm showing images from other websites as thumbnails. To do this I display them in a smaller img tag so the browser does the size decrease.
The problem is that the quality of these images (which I have no control of) is diminished.
Also they look much better in FF and Safari than in IE.
Is there a way to make these images look better without caching them on my server? (e.g a javascript library that does the resize with better quality)? Any idea is highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
IE 的默认图像调整大小算法并不是那么好 - 它可以通过调整注册表项来更改,但这当然不在您的控制范围之内。
然而,显然它也可以通过 css 源来触发以更好地调整图像大小
: http://edmondcho.com/blog/2009/03/17/internet-explorer-image-resizing-tip/
IE's default image resizing algorithm is not that nice - it can be changed by tweaking a registry entry, but of course that is outside of your control.
However, apparently it can also be triggered to do a better image resize through css
source: http://edmondcho.com/blog/2009/03/17/internet-explorer-image-resizing-tip/
谷歌快速搜索显示,在 IE7 中您可以修复图像质量问题:
http://devthought.com/tumble /2009/03/tip-high-quality-css-thumbnails-in-ie7/
A quick Google search shows that in IE7 you can fix the image quality problem:
http://devthought.com/tumble/2009/03/tip-high-quality-css-thumbnails-in-ie7/
控制的唯一方法是自己调整大小。 不同的浏览器将使用不同的算法,有些具有不清晰的遮罩,有些则没有。 调整大小后使用的过滤器控制了大部分。 特定的 CSS 标记可以在一定程度上控制这一点。
JavaScript 无法真正处理这个问题,但使用 Flash 或类似的东西可以做到这一点。 您可以更好地控制图像。 然而,就 HTML 而言,您将失去“图像性”。
The only way to have control is to do the resizing yourself. Various browsers will use different algorithms, some with unsharp masking, some without. The filters used after resizing control most of this. Specific CSS tagging can control this to some extent.
Javascript can't really handle this, but using Flash or similar would allow this. You would have better control of the image. However, you would lose the "imageness" as far as HTML.
我没有看到其他人提到的一件事 - 你并没有真正调整图像的大小,你只是将其显示在较小的空间中。 假设您正在拉取一个非常大的图像文件 (5MB) 并以 1 x 1 的分辨率显示它 - 它仍然是 5MB!
为这些图像编写缓存解决方案一点也不困难,并且可以避免您承担法律后果和尴尬。 如果我在我的日志文件中看到您的网站并意识到您正在删除我的图像,那么您将会很痛苦。
One thing I didn't see mentioned by the others - you aren't really resizing the image, you are just displaying it in a smaller space. Let's say you are pulling down an extremely large image file (5MB) and displaying it at 1 x 1 - it's still 5MB!
Writing a caching solution for these images wouldn't be very difficult at all - and will save you the legal ramifications and embarrassment. If I saw your site in my log files and realized you were pulling down my images, you would be Goatse'd - hard.
如果您正在使用源图像并只是在客户端上重新调整大小,则没有一个好的方法可以做到这一点。
现在,除了使用其他网站图像的潜在法律后果之外,您可以查看一个简单的缓存过程,并快速调整图像大小,并保持宽高比,以便显示效果良好。 这也有助于减少您从其他站点使用的带宽。
If you are working with a source image and simply re-sizing on the client, there isn't going to be a good way to do this.
Now, aside from the potential legal ramifications of using other sites images you could look at a simple caching process, and do a quick re-size on the image, and keep the aspect ratio, so that the display is good. This also helps reduce the bandwidth that you are using from the other sites.