firefoxs 在 png 的内容框边缘以特定宽度渲染细灰色线 - 为什么?
当 firefox (3.0.6) 以特定宽度(例如 50%)渲染 png 图像时,内容框的左边缘和上边缘会显示一条细灰色线。 该线在其他宽度(例如 70%)处消失。 此外,该线似乎不存在于原始图像中(使用 gimp 检查图像)。
这种现象发生在没有 CSS 样式标记的情况下——在下面的 HTML 示例中,CSS 的出现是为了阐明灰线的位置——很明显灰线出现在内容框的最边缘本身。
我很难想象这是一个真正的 Firefox 错误,并且想知道我忽略或没有掌握什么概念...
感谢您的时间和任何建议/想法...
可以看到图像 此处 http://datlisp.blogspot.com/2009/02/img- width-tag-and-firefox-rendering-of.html
html:
<html>
<head><title>problems with pngs</title></head>
<body>
<div style="border-color: red; border-width: thin; border-style: solid;
padding: 2px">
<img src="http://imagebin.ca/img/ato4dM.png"
width="50%"
style="border-color: blue; border-width: thin; border-style: solid;
padding: 2px;"/>
</div>
</body></html>
When firefox (3.0.6) renders a png image at certain widths (e.g., 50%), a thin grey line is shown along the left and top edges of the content box. The line disappears at other widths (e.g., 70%). Furthermore, the line doesn't seem to be present in the original image (using gimp to inspect the image).
The phenomenon occurs in the absence of the CSS style markup -- in the HTML example below, the CSS is present to clarify where the grey lines are located -- it seems clear that the grey lines are appearing at the very edge of the content box itself.
I have a hard time imagining this is a bona fide firefox bug and am wondering what concept I'm overlooking or not grasping...
Thanks for your time and any suggestions/thoughts...
The images can be seen here http://datlisp.blogspot.com/2009/02/img-width-tag-and-firefox-rendering-of.html
html:
<html>
<head><title>problems with pngs</title></head>
<body>
<div style="border-color: red; border-width: thin; border-style: solid;
padding: 2px">
<img src="http://imagebin.ca/img/ato4dM.png"
width="50%"
style="border-color: blue; border-width: thin; border-style: solid;
padding: 2px;"/>
</div>
</body></html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
将图像另存为 PNG-24。 当我尝试在浏览器中动态调整 PNG-8 图像的大小时,我也遇到过类似的像素失真问题。
另外,我不确定这是否适用于您的特定情况,但如果可能的话,您应该在将图像显示到浏览器之前调整图像的大小。 如果您尝试以较小的格式显示非常大的图像,依赖浏览器调整大小会导致失真,并且可能会增加带宽使用量。
更多信息:http://graphicssoft.about.com/od/aboutgraphics/l /blresizehtml.htm
Save your images as PNG-24. I have had similar issues with pixel distortion when trying to resize PNG-8 images dynamically in the browser.
Also, I'm not sure if this will work in your particular situation, but if possible you should resize the images before they are displayed to the browser. Relying on browser resizing leads to distortion and may increase bandwidth usage if you are trying to display very large images in a smaller format.
More information: http://graphicssoft.about.com/od/aboutgraphics/l/blresizehtml.htm
我一直在处理的图片库也遇到了类似的问题(抱歉,无法链接,因为我是新人)。 缩略图显示实际大小,没有进行 html/css 大小调整。
有时,它们会在图像 div 和投影背景之间的右侧和底部获得 1 像素宽的线。 我们花了一段时间才弄清楚为什么这种情况只偶尔发生,但我们将其范围缩小到 Firefox 缩放设置。
如果您在 Firefox 中缩放页面(ctrl 和鼠标滚轮,或 ctrl 和 +/-),那么就像您的情况一样,它们会以特定的缩放级别显示。 重置为 100% 缩放(ctrl 和 0)每次都能为我们解决问题,但对使用缩放功能的人没有帮助。
I've had a similar problem with an image gallery I've been working on (sorry, can't link as I'm new). The thumbnail images are displayed actual size with no html/css resizing going on.
Sometimes they gain a 1 pixel wide line on the right and bottom between the image div and the drop shadow background. It took us a while to work out why it only happened sometimes but we narrowed it down to the Firefox zoom settings.
If you zoom the page in Firefox (ctrl and mousewheel, or ctrl and +/-) then just like in your case they appear at certain zoom levels. Resetting to 100% zoom (ctrl and 0) fixed it every time for us but doesn't help people that use the zoom feature.
使用您的演示页面和图像,我没有发现任何问题。
也许是视频驱动程序的问题? 我相信 Firefox(以及它使用的图形库 cairo)利用硬件加速来平滑地调整图像大小,不幸的是您无法禁用它。
尝试通过远程协议登录来检查视频卡。
至少你可以得到一些内心的平静。 :)
Using your demo page and image I wasn't able to see anything wrong.
Maybe it's problem with video drivers? I believe firefox (and cairo, the graphics library it uses) takes advantage of hardware acceleration to resize images smoothly, and unfortunately you can't disable it AFAIK.
Try logging in through a remote protocol to go around the video card and check it out.
At least you can get some peace of mind. :)
在 div 标签中显示 .png 图像时,我遇到了类似的问题。 图像一侧呈现出一条细黑线。 为了解决这个问题,我必须添加以下 CSS 样式:
box-shadow: none;
I had a similar problem when displaying a .png-image in a div-tag. A thin, black line was rendered on the side of the image. To fix it, I had to add the following CSS style:
box-shadow: none;