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
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)
check that http://phpthumb.sourceforge.net/ it has some filters that you can use to generate other colour schemes.
timthumb now supports image filters… inluding (drumroll) a grayscale filter.
http://www.binarymoon.co.uk/2010/08/timthumb-image-filters/
totally server-side and timthumb has seen a lot of speed improvements with its caching… so the images are not re-created every time.
then you could spit out the image again w/o the filter… so that you have 1 color and 1 gray scale…. absolutely position the one on top of the other and use jquery to animate opacity on hover. i don’t like the double markup, but doing everything on the fly (i tried using pixastic) on multiple images just dragged my load time way down.
i found i had to use timthumb on both to ensure they’d be exactly the same size… and prevent any random pixel rounding errors.
in the loop you can get the featured image’s info w/ some of the following: