Add support for images with data expressed in non-8bit values.

Adds support for 12 bit images and allows loading images which define quantization tables after the frame.