[I think we might be able to do a bit better here, as compression doesn't really matter: we have a Rust vec; when Chrome displays it, it is probably going to be a flat expanded memory rep too; it seems kind of silly to send it through png or loss-less jpg round trip compression / decompression].
You could look at the way png encodes data and see of you can add an appropriate header to the raw pixel data to make it be considered a valid png file and then convert this to a Blob to use as image source. Or you could use the putImageData method for a canvas 2d context. I don't know which method is the fastest.
Covered by the Microsoft Open Specification Promise; while Microsoft holds patents against BMP, they have published a promise not to assert its patent rights as long as specific conditions are met. This is not the same as a license, however. BMP is included under the Windows Metafile Format (.wmf).