Is there a simple way to display a color bitmap in grayscale with just HTML/CSS
?
It doesn\'t need to be IE-compatible (and I imagine it won\'t be) -- if
For Firefox you don't need to create a filter.svg file, you can use data URI scheme.
Taking up the css code of the first answer gives:
filter: url("data:image/svg+xml;utf8,<svg%20xmlns='http://www.w3.org/2000/svg'><filter%20id='grayscale'><feColorMatrix%20type='matrix'%20values='0.3333%200.3333%200.3333%200%200%200.3333%200.3333%200.3333%200%200%200.3333%200.3333%200.3333%200%200%200%200%200%201%200'/></filter></svg>#grayscale"); /* Firefox 3.5+ */
filter: grayscale(100%); /* Current draft standard */
-webkit-filter: grayscale(100%); /* New WebKit */
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: gray; /* IE6+ */
Take care to replace "utf-8" string by your file encoding.
This method should be faster than the other because the browser will not need to do a second HTTP request.