1

So I have .DNG files that I have taken from an iPhone and I'm trying to figure out how to stack them and then output the stacked photo as a .DNG file as well (or any RAW format tbh).

I know how to code fairly well so I am able to stack them using python and the rawpy module. The problem is that rawpy currently has no way to output RAW files. So when I stack them, I can output as JPG, but that's not what I want.

Going through astro photography forums, I've seen threads that say that Deep Sky Stacker can be used to read and stack RAW files, but I couldn't find any guides that can tell me how to export an image as a .DNG file.

Does DSS output stacked photos as RAW? (format doesn't matter, but DNG would be preferred) Is there a way to do this through Lightroom, maybe? Is there any way to do this programmatically?. I'm fairly new to all this so any help would be appreciated.

2

DNG is not a format to export pictures, it is a somewhat universal format for sensor data. There would be no point in re-mosaicing the result of your stacked pictures.

If you want to export your picture in a lossless and high precision format, there are at least the 16-bit TIFF format and the 16-bit PNG.

  • The problem is that my workflow requires me to process the long exposure as RAW files to work on the sensor data. Because iPhones don't do long exposure images, I'm stacking the pictures as if they were long exposures. Does TIFF preserve the sensor data? I'm not really comfortable with TIFFs as I've never worked with them before – QuantumHoneybees Jan 17 at 17:45
  • DNG can be an export format; darktable exports HDR (literal HDR, not tonemapped "HDR") DNG files when using the "create HDR" function on selected images (this feature probably isn't appropriate for what the OP has in mind, though). – junkyardsparkle Jan 17 at 21:33
0

If you want to work on the raw sensor data, you need to do it before you stack the images. Export the raw files as one of many different rater formats (TIFF, JPEG, PNG, etc.) and then stack them. Raw sensor data can only be demosaiced once, then it is in a raster format. If you want to go back and demosaic it again, you must start with the original raw data you started with before. When you apply different processing decisions to that data, you produce a different version of the raw data as a viewable image than you did before.

Please note that what you see on your screen when working with a raw file is not "the raw file",¹ it is one demosaiced version of the info in the raw file. As you move the sliders or light curves within a raw processing application you are often creating a different interpretation of the info in the raw file by changing the demosaicing instructions and a new interpretation of the raw data is rendered again on your screen.

¹ The linked answer to another question goes into much greater detail about the difference between a raw image file and what you see on your screen when you open a raw file with a raw processing application. There's no need to repeat all of that here.

  • I understand, but since raw images are just sensor data, and exposure stacking is just the average of the photos, I'm trying to stack the data before demosaicing, that way the raw data when demosaiced simulates the effect of a long exposure, and I can still work with the sensor data for my later workflow. I know it's a tall order, but that's why I'm here :) – QuantumHoneybees Jan 17 at 18:40
  • @QuantumHoneybees It doesn't work that way with raw processing applications or stacking applications that demosaic the information from the sensor. – Michael C Jan 17 at 18:42
  • Raw data is not really what one would typically understand to be a photo any more than a latent, undeveloped negative is a "photo". – Michael C Jan 17 at 18:43
  • Yes, but numbers are numbers at the end of the day, which means they can be averaged. I just thought that there had to be an application that has DNG exporting built in that also allows for stacking... – QuantumHoneybees Jan 17 at 18:49
  • Just as there are many possible images that can be derived from the raw image data, there are many different sets of raw image data that can result in a particular image. There is no way to use a raster image to precisely reconstruct the raw data from which that raster image was derived. If you round all of the lines on your tax return to the nearest dollar, there is no way to recover the values of the cents portion of each original value. – Michael C Jan 17 at 18:49
0

Lightroom version 6 and later can create an HDR image from multiple exposures and export it as DNG file, see for instance https://helpx.adobe.com/lightroom/help/hdr-photo-merge.html. Note that DNG does not necessarily contain raw, mosaiced data from a sensor. It can also store demosaiced data, for instance the result of preprocessing (such as Lightroom's HDR creation). It is called a Linear DNG then, see https://helpx.adobe.com/de/photoshop/using/adobe-dng-converter.html.

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.