且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JavaScript过滤器图像颜色

更新时间:2022-10-18 08:40:56

在Internet Explorer中,我在IE中执行此操作的原因是因为我在制作一个小的侧边栏小工具。您可以使用可视化过滤器。 / p>

编辑:您要使用光过滤器,这里是一个例子

  .aFilter {
filter:light();
}
< / STYLE>
< SCRIPT>
window.onload = fnInit;
function fnInit(){
oDiv.filters [0] .addAmbient(50,20,180,100);
}
< / SCRIPT>
with filter:< img CLASS =aFilterID =oDivsrc =http://cache2.artprintimages.com/p/LRG/8/853/2USY000Z/black-and-white-cats .jpg>

without:< img src =http://cache2.artprintimages.com/p/LRG/8/853/2USY000Z/black-and-white-cats.jpg>


Hey, I'm looking for a way to take a black and white img element, and using JavaScript, specify an RGB value so that the image becomes that color. Any ideas (aside from libraries)?

Also I'm trying to do this with IE only. The reason I'm doing it in IE only is because I'm making a small sidebar gadget.

In Internet Explorer, you could use Visual Filters.

Edit: you want to use the Light filter, here is an exemple

<STYLE>
   .aFilter {
            filter:light();
        }
</STYLE>
<SCRIPT>
window.onload=fnInit;
function fnInit(){
   oDiv.filters[0].addAmbient(50,20,180,100);
}
</SCRIPT>
with filter: <img CLASS="aFilter" ID="oDiv" src="http://cache2.artprintimages.com/p/LRG/8/853/2USY000Z/black-and-white-cats.jpg">

without: <img src="http://cache2.artprintimages.com/p/LRG/8/853/2USY000Z/black-and-white-cats.jpg">