Fix rank dtype compatibility

Closes #466

`int8` images get converted to `uint8`, all other dtypes get converted to `uint16` and get bit shifted to `uint12`. The one iffy part is that `uint16` images with data only in the lower 12 bits don't get shifted because of backward compatibility.