重複の可能性あり:。 【アンチエイリアスをかけずに画像を引き伸ばす方法】(https://stackoverflow.com/questions/8597081/how-to-stretch-images-with-no-antialiasing)
画像を拡大するときに、アンチエイリアスを無効にすることはできないのでしょうか?
今現在、以下のようなものが表示されます。
。
次の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ベースのソリューションを好む。)
UPDATE 以下が提案されています。
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;
しかし、これでは背景画像に効果がないようです‼。
これを試してみてください。 すべてのブラウザで削除するための修正です。
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; /* Chrome */
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