How to convert raw formats to DNG

How to Convert Raw Formats to DNG
Adobe DNG Converter 8.3 running through wine-1.7.12 in a 64-bit Gentoo.
Adobe DNG Converter 11.1 running in Sabayon using wine 3.21. The "Linear (demosaiced)" option must be not selected in order to convert raw files to raw DNG, otherwise the DNG will contain an already-demosaiced (non-raw) image.

Digital photography cameras can most often save your images in the JPEG format, as well as dump the raw values from each of the millions of photosites which make up a sensor and store them, along with some metadata, in a proprietary raw format. Some cameras also let you choose DNG (Digital Negative) as the raw format, which is an open, lossless format developed by Adobe. Unlike JPEG images, which are already "developed", these raw files (both proprietary and DNG) contain raw data (ergo the name "raw file" - do not capitalize it, it is not an acronym!) which must first be processed before an image is obtained.

There are numerous benefits in converting your raw files to the DNG format:

  1. It has universal support. You may be able to use your DNG images in programs which do not have support for your non-DNG raw format.
  2. It is not a dead format - it is constantly maintained.
  3. Adobe's DNG Converter includes color matrices and white levels in the converted DNG files - these are usually not present in non-DNG files, and Adobe's ones are often more accurate than those from dcraw. This leads to more accurate color and lowers the chance of color casts in clipped areas.
  4. DNG files are often smaller than your original raw files due to better lossless compression. The camera software is limited by its hardware - it must write the raw file as quickly as possible and not draw too much current, so compression is optimized for speed, not for file size. Computer software does not have this limitation.
  5. Even if your camera supports shooting straight to DNG, your camera's implementation of DNG is likely outdated. In some cases it may be warranted to re-convert your old DNGs to a newer DNG specification using the newest version of Adobe's DNG Converter. Possible reasons could be that the newer color matrices might be more accurate, lossless compression might be improved, improved support for defective pixel marking, inclusion of new opcodes, injection of new useful metadata tags, etc.

If you do convert your raw files to DNG, you should first test a few sample DNG files to make sure everything in your workflow still functions correctly before deleting the source files. Having said that, issues with DNG are very rare, unlike the FUD surrounding it which is in no hurry of dying down.

Adobe's DNG Converter is not the only program that converts raw files to DNG. There is, for example, the kipi-plugins DNG Image Converter which uses LibRaw and libkdcraw, however it is unclear what matrices this converter uses or where it gets them from, therefore it is safer if you stick to using the official Adobe DNG Converter.

Get the latest version of Adobe DNG Converter here:

Run it and you're done.

1 Unsupported sensors

Adobe DNG Converter 8.3.0 set up to convert raw files to demosaiced DNG files. These DNG files are no longer really raw due to them being demosaiced, and in doing so you are relying on Adobe's demosaicing algorithms and can no longer benefit from using RawTherapee's demosaicing algorithms, so do not use these settings for raw files which are natively supported by RawTherapee.

The DNG format can contain real raw data, but it can also contain demosaiced images. These demosaiced images are no longer really raw - they have been pre-cooked. While this is generally undesirable, there are situations where we can take advantage of this possibility. Some cameras have sensors with color filter array layouts and sensor pixel layouts unsupported by RawTherapee. Though you cannot directly process these raw files in RawTherapee, you can convert them to demosaiced DNG files using the Adobe DNG Converter. As these demosaiced DNG files are no longer truly raw, do not delete your original raw files! This procedure is merely a workaround.

To convert raw files not currently supported by RawTherapee to demosaiced DNG files, use the following settings:

  • "Custom" compatibility mode using "DNG 1.4"
  • "Linear (demosaiced)" must be ticked.

The resulting DNG files may end up being larger than the input files - as an example, an input RAF file resulted in a DNG file 142% larger in size.

These demosaiced DNG files can now be used in RawTherapee (or any other DNG-supporting program), though as they are already demosaiced the tools in the "Raw" tab will be disabled.

2 Installing Adobe DNG Converter in Linux

When you run Wine it will create a basic Windows system by default in $HOME/.wine. That is called a "Wine prefix". While it's fine to leave it like that, you can run each Windows program in its own Wine prefix, so that you can easily and cleanly remove all traces of one program without affecting the others. For example you might keep Adobe DNG Converter in its own Wine prefix in $HOME/wine-dng and decide to try out some proprietary Windows HDR program. You might find out that you don't like this program, or that the trial period has expired, or that it simply doesn't work. Uninstalling it, if the uninstaller even works, is known to leave things behind. If, on the other hand, you installed this program to its own Wine prefix, say $HOME/wine-hdr, you could simply delete that folder and that program would be gone without a trace, without affecting Adobe DNG Converter. Creating a new Wine prefix is very simple. All you have to do is to prepend WINEPREFIX=$HOME/some-folder before the "wine" command. If that folder does not exist, Wine will create it for you.

We will be using $HOME/wine-dng as the Wine prefix.

  1. Install Wine, preferably using your package manager.
  2. Download Adobe DNG Converter for Windows.
  3. Install Adobe DNG Converter:
    WINEPREFIX="$HOME/wine-dng" wine ~/Downloads/DNGConverter_version.exe
    It will install to $HOME/wine-dng/drive_c/Program Files (x86)/Adobe/Adobe DNG Converter.exe
  4. There is an issue affecting all versions of Wine older than 5.0-rc5 when using Adobe DNG Converter version 11.2 or newer. The issue results in Wine crashing on startup. The issue was fixed in Wine 5.0-rc5, see Wine bug #46972. If you use any version of Wine lower than 5.0-rc5, you can easily circumvent the issue.
    Run Wine configuration:
    WINEPREFIX="$HOME/wine-dng" winecfg
    Go to the "Libraries" tab, add a new override for api-ms-win-core-winrt-error-l1-1-0, then edit it and select "Disable". Done.
  5. Run Adobe DNG Converter:
    WINEPREFIX="$HOME/wine-dng" wine "$HOME/wine-dng/drive_c/Program Files (x86)/Adobe/Adobe DNG Converter.exe"
  6. Add an alias so that you can run Adobe DNG Converter from a console with ease:
    echo "alias dng='WINEPREFIX=\"\$HOME/wine-dng\" wine \"\$HOME/wine-dng/drive_c/Program Files (x86)/Adobe/Adobe DNG Converter.exe\"'" >> ~/.bashrc && exec bash
  7. To run Adobe DNG Converter, just type dng in a console.