How to convert raw formats to DNG
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:
- 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.
- It is not a dead format - it is constantly maintained.
- 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.
- 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.
- 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:
- Adobe DNG Converter for Windows (get this if you're using Linux - installation is explained below).
- Adobe DNG Converter for macOS.
Run it and you're done.
1 Unsupported sensors
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.
- Install Wine, preferably using your package manager.
- Download Adobe DNG Converter for Windows.
- 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
- 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:
- 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.
- Run Adobe DNG Converter:
WINEPREFIX="$HOME/wine-dng" wine "$HOME/wine-dng/drive_c/Program Files (x86)/Adobe/Adobe DNG Converter.exe"
- 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
- To run Adobe DNG Converter, just type
dngin a console.