There are ways to convert color image to black and white
on the client side with javascript. However, it won’t work in all browsers and it’s slow.
Is there a way to convert WordPress post-thumbnails to black and white
on the server side
automatically?
This is what I would like to achieve:
-
Upload a color image
-
Have it displayed in black and white
-
On hover change to its original color
You can use the php GD library which you most likely already have on your server since wordpresses uses it.
You can filter the image using imagefilter specifically IMG_FILTER_GRAYSCALE and/or IMG_FILTER_CONTRAST.
For example
imagefilter($im, IMG_FILTER_GRAYSCALE);
imagefilter($im, IMG_FILTER_CONTRAST, -100);
The hover would have to been done in javascript.
A much simpler solution would be to use the html5 canvas tag or a javascript image library like pixastic and wrestle with making it browser friendly ( not that hard using one of the html5 js kits)