在缩放图像时,是否有可能禁用反走样?
现在,我得到了这样的东西:

使用以下css代码:
#bib {
width: 104px;
height: 104px;
background-image: url(/media/buttonart_back.png);
background-size: 1132px 1360px;
background-repeat: no-repeat;
}我想要的是这样的东西:

简而言之,任何用于的CSS标志都会在缩放图像时禁用抗混叠,从而保留硬边。
任何javascript黑客或类似的也是受欢迎的。
(是的,我知道php和imagemagick也能做到这一点,但我更喜欢基于css的解决方案。)
更新建议如下:
image-rendering: -moz-crisp-edges;
image-rendering: -moz-crisp-edges;
image-rendering: -o-crisp-edges;
image-rendering: -webkit-optimize-contrast;
-ms-interpolation-mode: nearest-neighbor;但这似乎不适用于背景图像。
发布于 2012-12-28 10:37:24
试试这个,它是在所有浏览器中删除它的修补程序。
img {
image-rendering: optimizeSpeed; /* STOP SMOOTHING, GIVE ME SPEED */
image-rendering: -moz-crisp-edges; /* Firefox */
image-rendering: -o-crisp-edges; /* Opera */
image-rendering: -webkit-optimize-contrast; /* Chrome (and eventually Safari) */
image-rendering: pixelated; /* Universal support since 2021 */
image-rendering: optimize-contrast; /* CSS3 Proposed */
-ms-interpolation-mode: nearest-neighbor; /* IE8+ */
}资料来源:
http://nullsleep.tumblr.com/post/16417178705/how-to-disable-image-smoothing-in-modern-web-browsers
http://updates.html5rocks.com/2015/01/pixelated
GitaarLAB
发布于 2012-12-28 10:32:02
只在火狐中工作的CSS只适用于。
img { image-rendering: -moz-crisp-edges; } 它为我工作(火狐16.0)

https://stackoverflow.com/questions/14068103
复制相似问题