当我将Greyscale SVG滤波器应用于深色图像时,结果会在结果中获得显着的束缚。我使用的过滤器是:

     <!doctype html>
     <html>
     <head>
     <style>
      img {
     filter: url(#grayscale); /* Firefox */     
     filter: gray; /* IE */
    -webkit-filter: grayscale(1); /* Webkit */
    }
      img:hover {
    filter: none;
    -webkit-filter: grayscale(0);
    }
       </style>
    </head>
  <body>
  <img src="http://www.walldoze.com/static/cache/2048x2048/hd-wallpapers-space-iphone-  wallpaper-retina-2048x2048-wallpaper.jpg" width="1000">
  <svg xmlns="http://www.w3.org/2000/svg">
 <filter id="grayscale" >
 <feColorMatrix type="matrix"  values="0.3333 0.3333 0.3333 0 0.001 0.3333 0.3333 0.3333 0 0.001 0.3333 0.3333 0.3333 0 0.001 0 0 0 1 0.001"/>
  </filter>
  </svg>
  </body>
  </html>

enter image description here

有帮助吗?

解决方案

为了获得更好的性能,您可以将colorterPolation-filters属性设置为过滤器属性上的“ srgb”:

<filter id="greyscale" color-interpolation-filters="sRGB">
  <feColorMatrix type="saturate" values="0"/>
</filter>

但是,据我所知

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top