added stepwise image downsampling to improve the resulting image quality

html5 canvas is not very good at downsampling jpegs, the output quality is very poor.
this improvement does a stepwise downsampling which greatly improves the image quality.

the method is discussed here: http://stackoverflow.com/questions/17861447/html5-canvas-drawimage-how-to-apply-antialiasing

self-explanatory example, downsized from 1920x1200:
![test-043](https://f.cloud.github.com/assets/1469382/2251163/4fd0526c-9d99-11e3-96e9-8c8c501a2282.jpg)
![test-044](https://f.cloud.github.com/assets/1469382/2251164/4fd59a1a-9d99-11e3-84c9-cdb5543e5c5c.jpg)