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?

  • Both NEF and DNG-based solutions are okay, but I don't expect to find a solution for NEF, so I asked about DNG. I am looking for a simple solution that doesn't involve reading the DNG specification and doing it from scratch. That would suddenly make the (boring and tedious) programming the biggest part of the task.
    – Szabolcs
    Aug 21 '13 at 20:38

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.

  • Thanks Patrick, I'll take a look. I'm fine with C++ but if most of the time is taken up by these file format coding details (as opposed to being able to experiment with the noise reduction itself), I'll probably drop it.
    – Szabolcs
    Aug 21 '13 at 22:39
  • Like most things figuring out exactly how to do it will take way more time than the actual coding. Of course once it is done you could package up a nice XMP/TIFF to DNG utility. Aug 21 '13 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.