我有一张像素为 100x100 的图像。我想显示它两倍的大小,所以 200x200,我想通过 CSS 来完成,而不是通过服务器来完成。
几年以来,所有浏览器都对图像进行了抗锯齿处理,而不是按像素缩放。
Mozilla 允许指定算法: image-rendering: -moz-crisp-edges;
IE 也是如此:-ms-interpolation-mode:nearest-neighbor;
有任何已知的 webkit 替代品吗?
WebKit 现在支持 CSS 指令:
image-rendering:-webkit-optimize-contrast;
您可以使用 Chrome 和此页面上的最后一张图片来查看它的运行情况:
http://phrogz.net/tmp/canvas_image_zoom.html http://phrogz.net/tmp/canvas_image_zoom.html
该页面上使用的规则是:
.pixelated {
image-rendering:optimizeSpeed; /* Legal fallback */
image-rendering:-moz-crisp-edges; /* Firefox */
image-rendering:-o-crisp-edges; /* Opera */
image-rendering:-webkit-optimize-contrast; /* Safari */
image-rendering:optimize-contrast; /* CSS3 Proposed */
image-rendering:crisp-edges; /* CSS4 Proposed */
image-rendering:pixelated; /* CSS4 Proposed */
-ms-interpolation-mode:nearest-neighbor; /* IE8+ */
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)