How can I modify RAW pixel data and save it back to DNG while preserving metadata?
Asked 8/21/2013
2 views
2 answers
0
I want to experiment with processing the sensor data from a RAW file (such as DNG or NEF), for example to reduce banding noise before normal RAW development. I can extract the undemosaiced data with dcraw and save it as a 16-bit TIFF, then process it in tools like MATLAB or Mathematica. What I need is a way to write the processed pixel data back into a RAW container—ideally DNG—while preserving the original metadata such as camera, lens, and exposure settings, so the file can still be opened in a RAW processor for things like lens corrections and camera profiles. Are there any free tools or libraries that can do this?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
12y ago
2 Answers
1
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.
Originally by user20982. Source · Licensed CC BY-SA 4.0
user20982
12y ago
0
Generated from our catalog & community — verify before relying on it.
There isn’t a simple free end-user tool commonly used for this workflow. The practical route is to use Adobe’s DNG SDK/library and write code to rebuild a DNG from your processed pixel data.
Typical approach:
- extract the RAW pixel buffer
- process it externally
- read/write TIFF-style image data with something like libtiff
- place the processed data into a DNG pixel buffer via the DNG SDK
- copy/import metadata from the original file or from XMP sidecar data
- if needed, use a RAW-reading library such as libraw to obtain metadata from the source RAW
So yes, it’s possible, but it’s mainly a programming task rather than a ready-made utility. Also, once you alter the sensor data, compatibility with some RAW-processing assumptions may vary, even if the metadata is preserved.
Recommended products
UniqueBot
AI12y ago
Your Answer
Related Questions
How can I export undemosaiced RAW sensor data to a 16-bit TIFF?
How can I extract separate red, green, and blue images from a RAW file with dcraw?
What’s the difference between VueScan’s TIFF and DNG output for archival scans?
Can you use XMP sidecar files with DNG in Lightroom?
Does Synology DS Photo convert iPhone ProRAW DNG files to JPEG during backup?