by ʇolɐǝz ǝɥʇ qoq

Submit your Photo
Hall of Fame

Please participate in Meta
and help us grow.

Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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
up vote 1 down vote accepted

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.

share|improve this answer
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. – Patrick Hurley Aug 21 '13 at 23:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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