jsbmp - JavaScript Bitmap Generator =================================== Create Windows bitmap (.BMP) files with JavaScript. Please note that this is not a high-level image composition library: included functions do little more than pack raw pixel data. It supports 24-bit uncompressed (BI_RGB): // 5x1 pixel progression from black to light grey var greys = bmp_rgb(5, 1, ['000000','333333', '666666', '999999', 'cccccc']); And 8-bit run-length encoded (BI_RLE8): // 2000x2 pixel line, blue on top and red below var bluelineredline = bmp_rle8(2000, 2, [['0000FF', 2000], ['FF0000', 2000]]); Cool Examples ------------- * [A Mario sprite generated from X PixMap v2 text data](xpm2.html) * [A tiled background with dynamic size and colours](bg.html) Compatibility ------------- Tested with Firefox 3.0.11, Internet Explorer 8 and Safari version something. Please note that, although version 8 finally adds `data` URI support to Internet Explorer, it is limited to URIs 32,000-odd characters long. (Consider that one pixel in an uncompressed bitmap takes up 4+ bytes, for a maximum base64-encoded size of ~80x80.) Sources ------- Bitmap generation: * [jsbmp.js](jsbmp.js) Supporting files: * [datauri.js](datauri.js) - generate `data` URIs * [xpm2.js](xpm2.js) - parse XPM v2 text Extra: * [jsbmpblock.js](jsbmpblock.js) - has one function, `block(width, height, colour)`, which is more or less a minified/optimized `bmp_rle8()`. Firefox only; [demo](block2.html).