Just an update.

I remember seeing some time ago a script that draws shapes using divs and javascript that optimises the number of divs for each shape.

It can be found here
www.walterzorn.com/jsgraphics/jsgraphics_e.htm
and is actually a good read for any graphics designer.