Overwriting/Generating fake Nikon .NEF raw files

Hello,

I would like to know if it is possible to modify raw data or generate completely fake raw files with LibRaw?
If not can someone please point me in the right direction?

I searched intensively but have no luck with finding any information about generating NEF files or DNG files from scratch. Alternatively it would probably suffice just to somehow overwrite the image data contained in the NEF raw file.

Any ideas on how to do this?
I'm not a real developer I just write python most of the time.

Forums: 

LibRaw reads RAW files, but

LibRaw reads RAW files, but not writes into them.

To create DNG file you may use Adobe DNG SDK

-- Alex Tutubalin @LibRaw LLC

Thank you for your reply!

Thank you for your reply!

I thought that at least there should be some specs about the DNG file format. The SDK is great!
This might help me a bit.

But the thing I really need is NEF editing. If anyone has any hints please tell :-)
I found rawpy which uses libraw and reads NEF files. Loads the undemosaiced raw data.
Only thing missing now is a way to overwrite the file.

Both DNG and NEF are TIFF/EP

Both DNG and NEF are TIFF/EP containers, so the spec you're after is the TIFF/EP spec. On top of that there is custom tags in both formats: the DNG ones are described in its spec (surprised you couldn't find it), the NEF ones you can glimpse maybe from e.g. ExifTool, but I don't think it's published by Nikon. I think you pretty much have to come up with your own writer, or use some TIFF library and extend it.