This is a simple BMP encoder in Javascript.