Make 8-bit images in JavaScript