Display Images as Grayscale with CSS Filters
CSS filters aren't yet widely supported but they are indeed impressive and a modern need for web imagery. CSS filters allow you to modify the display of images in a variety of ways, one of those ways being displaying images as grayscale.
Doing so requires the most minimal of CSS:
img.bw {
filter: grayscale(1);
}
You can even animate an image to or from grayscale:
img.bw {
filter: grayscale(0);
}
img.bw.grey {
filter: grayscale(1);
transition-property: filter;
transition-duration: 1s;
}
CSS filters allow much more than just grayscale adjustments, so if you haven't taken the time, please play around with my CSS filter sandbox. Remember that if the user chooses to download the image, it is downloaded in its original colored displays, but for online display purposes, CSS filters do the trick!
![I’m an Impostor]()
This is the hardest thing I've ever had to write, much less admit to myself. I've written resignation letters from jobs I've loved, I've ended relationships, I've failed at a host of tasks, and let myself down in my life. All of those feelings were very...
![5 HTML5 APIs You Didn’t Know Existed]()
When you say or read "HTML5", you half expect exotic dancers and unicorns to walk into the room to the tune of "I'm Sexy and I Know It." Can you blame us though? We watched the fundamental APIs stagnate for so long that a basic feature...
![MooTools Flashlight Effect]()
Another reason that I love Twitter so much is that I'm able to check out what fellow developers think is interesting. Chris Coyier posted about a flashlight effect he found built with jQuery. While I agree with Chris that it's a little corny, it...
![dat.gui: Exceptional JavaScript Interface Controller]()
We all love trusted JavaScript frameworks like MooTools, jQuery, and Dojo, but there's a big push toward using focused micro-frameworks for smaller purposes. Of course, there are positives and negatives to using them. Positives include smaller JS footprint (especially good for mobile) and less cruft, negatives...
I knew about CSS filters, but what always restrained me to use them is that they’re limited to Webkit/Blink browsers. Firefox supports just the url syntax.
Many designers love them and for a reason. I just wish they were more widely supported.
I cant find the difference between the 3 images. All images seems to be the same color! Is this a browser problem (firefox) or i don’t see it?
Yes, it doesn’t display the CSS filters effect in Firefox and also Opera… Hopefully it will be cross-browser in the future.
I haven’t used css filters so far and this article fits perfectly for a design I want to implement.
Thanks so much, great stuff
Is there a Firefox workaround for this?
Grayscale is even better appreciated when used in action. It works perfectly on latest version of Chrome and firefox as seen on http://www.myweeblytricks.com/2014/09/weebly-tricks-72-grayscale-image.html
Unfortunately it does not work in IE11.
Check this, it worked for me perfectly: https://chrome.google.com/webstore/detail/grayscale-black-white-col/cjimlckjgclgboeebpjlipmokolejppk?hl=en (Chrome only) Using this app I can convert any web page to black & white color scheme.