Today, HTML5-compatible browsers already provide bilinear filtering on <canvas> and in WebGL for images when you resize the graphics.
However, I encountered a situation in which I need a bilinear resize of a Sprite, on only that one. Javascript is too slow to do it realtime, so I implemented that in a WebGL shader.
<img src="https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/demo.png" border="0">
This shader is a quick port to C2 of the GLSL shader from there :
http://www.gamerendering.com/2008/10/05/bilinear-interpolation/
The bilinear filter works in both directions (image magnification and shrinking).
It works with 4 parameters :
<img src="https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/parameters.png" border="0">
The Texture Width Size is the new width you want to have, Texture HeightSize is the new height, the X pixel size must be set to 1.0/Texture Width, and the same for Y pixel size (1.0/Texture Height).
You get that kind of after/before effect (however no hope of regrowing your hairs back with a shader...):
<img src="https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/beforeafter.png" border="0">
The demo : https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/index.html
The effect .zip archive : https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/pode_bilinear_filter.1.0.zip (put it inside the effects folder !
The .capx : https://dl.dropbox.com/u/1412774/WebGLBilinearEffectDemo/WebGLBilinearEffectDemo.capx