Monday, 1 July 2019

software - How can I change the pixel data in a DNG while keeping all the metadata?


I am looking for some free tools that will let me easily process the pixel data in a RAW file (DNG or NEF) while keeping the metadata untouched. Are there any such tools?




Use case: I am experimenting with reducing banding noise. I can get the un-demosaiced data from the RAW file using dcraw and write it into a 16-bit TIFF: dcraw -o 0 -D -T -4. I can then process this data using various tools (e.g. Mathematica/MATLAB) and try to reduce the noise. Now how can I put the processed data back into a raw file (I'm thinking DNG) and keep all the original metadata (camera, settings, lens) so I can feed it to a raw processor such as ACR and make use of automatic lens corrections and camera profiles?



Answer



How serious are you? Adobe has a library that can do just this, but it is a CPP library so you will have to write some code to make it happen. You will need to use something like libtiff to get the pixel buffer from the image and then feed it into a dng_pixel_buffer and build the DNG inserting all the meta data (you can import from and XMP sidecar if it is available or pull from CR2 using libraw.


No comments:

Post a Comment

Why is the front element of a telephoto lens larger than a wide angle lens?

A wide angle lens has a wide angle of view, therefore it would make sense that the front of the lens would also be wide. A telephoto lens ha...