Hi, I have a 12 bit image coming from my cameras which I want to write to a file in a lossless format with custom metadata for further post processing in Matlab. Using this I can write grayscale PNG images with metadata. However, when I open the images in Matlab, the pixel values are not the same as if I write them out to a text file. It seems as there is some weird rescaling going on in the background, which I don't fully understand.
If I save the images as a lossless JPEG2000 file using this, the values are correct in Matlab but the custom metadata is not saved.
Is there a way to save to a PNG file without altering the data or some other way of writing custom metadata to a JPEG2000 or another lossless image file format (which does suport 12bit images)