Is there any software to edit RAW DNG pixel data without demosaic, and save changes directly to RAW?

  • 2
    Keep in mind that whatever you see on your monitor, whether demosaiced or not, has also had a lot of other processing applied to make it a viewable image. For more, please see: What does an unprocessed RAW file look like? and Why RAW and JPEG look the same? You might think what you are looking at on your screen is "THE raw file" but what you are seeing is a very processed version of monochromatic luminance values for each photosite/sensel/pixel well. – Michael C Jul 7 '20 at 10:02
  • For more on how colors are created from monochromatic luminance values, please see: RAW files store 3 colors per pixel, or only one? and Why are Red, Green, and Blue the primary colors of light? The latter goes into great detail about how the way we process raw files mimics the way our brains create color information from the simple brightness values sent to it by the cones in our retinas. – Michael C Jul 7 '20 at 10:07
  • 1
    Another question for which the accepted answer describes the fundamental difference between a raw file with, say, 14-bit monochromatic luminance values and a TIFF file with 16-bit per 3 RGB color channels and the color multipliers already baked in is Why can software correct white balance more accurately for RAW files than it can with JPEGs? – Michael C Jul 7 '20 at 10:21
  • Hi, I need to adjust the monochromatic luminance values of pixels, and save to RAW again. And then open in a "RAW processing software". – jsmith Jul 8 '20 at 6:47
  • I'm not aware of any available product that does that. You would in effect be generating a new raw file, but nothing currently out there does that. What kind of adjustments do you wish to make? Why can't you use the raw processing software you plan to use afterwards to do that? – Michael C Jul 8 '20 at 19:18

The RAW data is the RAW data. You do not save changes to the raw file.

I.E. You can not alter the data within the RAW file/container itself.

If you use software to edit the RAW data you then save those edits to another file format such as JPEG or TIFF, the RAW file/container itself is not changed.

I do not know if there is any software that will read a RAW file without first applying demosaic. That is above my pay grade.

I would suggest you do some research on RAW files in books as well as on the internet so you have foundation of knowledge of what one needs to do to work with them. This will help you to ask informed questions.


As user Please Read My Profile demonstrates in his answer to What does an unprocessed RAW file look like?, DCRaw and many of the raw conversion applications which draw upon DCRaw under their hoods are capable of doing what you desire in terms of converting linear sensor output to a viewable monochrome image without demosaicing.

With some raw processors that use DCRaw under the hood you can save the instruction set as a sidecar file or as an internal part of the raw image file, but you can't save the changes to the actual raw sensor output data in the file. The instructions would probably only be readable by the same application that created them, though. You can export what you see on your screen after doing the adjustments as a TIFF or in another raster image format, but you'll have the black point, white point and color multipliers more or less "baked in."

Even though the displayed and exported image is monochrome, the relative tonal values between pixels (in the image) that correspond to sensels/photo sites/pixel wells (on the sensor) filtered by red', green', and blue' filters¹, respectively, will be affected by the color temperature, white balance, and color filters that are applied to the raw luminance values.

¹ We call them red', green', and blue' filters, but they're actually not the same colors as the Red, Green, and Blue primary colors we use in RGB devices. The red' filters in most Bayer masks is centered somewhere around 590-600nm that is more of a yellow-orange color than "Red" at 640nm. Likewise, the green' and blue' filters are slightly different than their RGB counterparts. Blue' filters are a bit closer to violet than RGB "Blue" and green' filters are a little closer to yellow than RGB "Green" is.

For more about DCRaw, which runs on a Linux platform, please see the explanation and FAQs here.

Note that most cameras which were available by 2018 are supported, but newer cameras may not be supported at all and aren't fully supported unless they use the same sensor and raw encoding method as a previous model that was already around in 2018.


I need to adjust the monochromatic luminance values of pixels, and save to RAW again. And then open in a "RAW processing software

This is (basically) equivalent to making an adjustment to exposure in post processing in any RAW processing system. You do not need to save and exit and reload to do that - it can all be done in one go.

Darktable (a free raw processing application I use myself) has an automatic setting for exposure that will do that without user intervention being required if you want. There's the default "manual" setting as well, of course. I'd expect other RAW processing applications to have similar options.

You do not save RAW data back and it would make little sense to do that - it would be like overwriting a negative - you want to keep the RAW data unaltered. That's the point of RAW - to have the actual data recorded that you can always go back to without any processing applied.


While theoretically possible, there is, to my knowledge, no existing software to do that; probably because there is little need for such an operation. If you have a specific need to do this, you'll have to write your own program. You can look into the DCRaw source code to read RAW files, you'll have to implement the writing yourself.

One application i know of that does (did) write to raw was the Zero Noise Virtual Raw project by Guillermo Luijk where he combined multiple RAW exposures into one, as a HDR input. But there seems little use for that as modern RAW processors will handle multiple input files for HDR just fine these days.

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.