1

I have an numpy array of size 2592 x 1944, and I want to save it as raw file format like ".nef" or ".raw". I wonder if there is any package or sample code to do this.

I see people asking related questions here How to save numpy array as .raw image? and someone suggestted using RawPy. However, after looking at RawPy I think it only allows opening a raw image and return the m x n array, which is exactly opposite to what I want to do (save a m x n array into raw image)

Thank you so much for helping!

7
  • What would be the point of doing that, please? Commented Dec 7, 2021 at 15:51
  • 1
    do you mean "raw" as in the photography file type, or just a bunch of bytes in a file, without any headers? dumping numpy arrays to file as binary data is well documented and explained. Commented Dec 7, 2021 at 16:03
  • For the purpose, we are some physicists working on simulating the image of cosmic ray particles in cell phone CMOS, and in order to convert the deposited charge on pixels into image, we plan to first use a QDC convertor model to get the raw image and then work on the raw image using some well-developped post image processing software. Currently we plan to use darktable.org Commented Dec 7, 2021 at 16:56
  • As for the definition of "raw", in fact we just want to convert the 2592 x 1944 pulse on pixel map into some file format that our image processing software can read in and do some Bayer interpolation, white balance, ... etc. It seems that it supports: RAW, NEF, RW1, RW2, ..... so anyone will be fine. I tried to save it as binary file with .nef end but it cannot be read into the software. I wonder if this is due to some missing metadata Commented Dec 7, 2021 at 16:59
  • If there is any other recommended post image processing software that could take a m x n numpy array and do some bayer interpolation and post processings, then please let us know. Thanks! Commented Dec 7, 2021 at 17:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.