Dealing with a 12 bit image


I am capturing a 12 Bit RGB image from a high speed camera. Putting the image through transformation using ImageBlock leads to creating an image with 8-bit depth. I think this is a feature of PILImage.create.
How can I retain the pixel depth of 12-bits while defining the dataBlock?


I don’t believe you can. PILImage uses Pillow, which do not seem to support 12-bit RGB. But I can be wrong.

You can preserve more-than-RGB and more-than-8bit if you do a little pre-processing. Pillow allows you to load in various additional “modes” and for you to write your own image loader ( - so in your case, you might return RGB “I” (=3x signed-32-bit-per-pixel). Depending on what format your data is currently in, it may be worth loading/recoding/saving it all out once in an easy-to-decode format (e.g. header+raw, rather than compressed), assuming your SSD is faster at reading in data than your python code will be at decoding.

1 Like