Is there any known/simple/open-source library that provide
a javascript function that will switch colored picture that is displayed in an html page into a black and white
That can be used in all the most used browsers (IE, FireFox, Chrome)?
I mean something like:
<html>
...
<img id="myPic" src="pic.jpg">
...
<script type="text/javascript">
function onEvent(){
var pic = document.getElementById("myPic");
magicFunctionToBlackAndWhite(pic);
}
</script>
</html>
looking for that magicFunctionToBlackAndWhite()
There’s no one solution that works across all browsers, but you can combine different solutions:
For IE, use the following CSS:
filter: GrayA lot of other browsers supports
canvas, so you should be able to use this javascript code for that.Of course it should’t be too much of a hassle to make an image b/w in a serverside language such as .net, so you could always have a javascript that in principle does something like the following:
…and then have all of the magic happening on the server.