Linear DNG

DNG is a "raw file format". But not only a "raw file format"! It can hold image data that is no longer raw. Or that didn't come from a digital camera. Or that didn't even come from a camera!


A usual TIFF file that comes out the back end of a raw converter has already been rendered, i.e., it has been mapped to a standard color space, it has been tone mapped, white balancing has been done, etc. More technically, the image is output-referred.

In contrast, the linear DNG is still scene-referred and can still benefit from many of the operations typically performed by a raw converter, such as white balance, the application of a camera color profile, HDR compositing, etc.

So the underlying internal file format looks similar, but the actual image contents and the types of operations that can be applied to that image are quite different. 
Eric Chan at DPReview

What is Linear DNG?

DNG has two varieties that deserve different names on this page:

  • "Raw DNG": The familiar variety of DNG, containing the raw image data plus added-value metadata. Almost all of the products that support DNG support at least this variety. (There are exceptions). This variety of DNG will gradually become the de facto standard raw file format.
  • "Linear DNG": A rarer variety of DNG, containing RGB image data (or not just RGB!) arranged in a rectilinear format. (Most practical examples of Linear DNG hold RGB image data, but it isn't a constraint, and 4 or more colours are allowed. For example, a Linear DNG obtained by converting the raw file from a Sony F828 has an extra channel, "Aqua", rather like Cyan). This RGB image data may have come from demosaiced raw image data, or from another source such as TIFF or JPEG or something else. (There is little difference between "demosaiced" and "never mosaiced").

Most other pages on this site focus on Raw DNG. This page focuses on Linear DNG. This variety of DNG may become an alternative to TIFF in a new set of digital image processors.


Benefits of Linear DNG

Support for unusual sensor configurations

Whether or not a raw converter can handle the raw image data from a particular camera depends partly on whether that raw converter can handle the sensor configuration concerned. It is easier for a raw converter designed to handle Bayer sensors to handle raw files from another Bayer sensor camera than from a camera that doesn't use a Bayer sensor. (This is not a flaw in DNG - it is simply a comment on the relative difficulties of handling different sensor configurations).

  • Possibly some raw converters only handle Raw DNG files from camera whose raw file formats they support anyway. (Some well-known early examples gave some people the false impression that this is a characteristic of DNG, rather than a deficient implementation in these products). This is becoming rarer, and I don't know of any current cases.
  • Some raw converters can handle Raw DNG files from cameras whose native raw file formats they don't support, but only where they support the sensor configuration concerned, for example Bayer sensor.
  • But - some raw converters support Linear DNGs from cameras that have sensor configurations that they don't support either via the native raw formats or the Raw DNGs. (Eg. Silkypix).

Opening up a new world of digital image processing

These quotes are about Adobe products - Lightroom and ACR. But that is irrelevant - this sort of processing is available in principle to any products that can handle Linear DNG. What is happening is that there is a "new breed" of comprehensive image processors, supplied by major companies. (Apple's Aperture, Adobe's Lightroom, Nikon's/Nik's NX, and perhaps some by smaller companies). They offer non-destructive editing, rather than pixel-replacement as in familiar photo-editors. These image processors are not just raw converters - all of these can handle TIFFs and JPEGs, and they provide similar features whether they are handling raws or those. In other words, "raw conversion", the demosaicing task, is a relatively small component of the product, and for many file formats isn't needed.

Thomas Knoll
"Interesting related factoid: Lightroom betas can convert JPEGs, TIFFs, and PSDs into DNGs, which can then be opened in Adobe Camera Raw.
Yes, it the "linearized" form. No, it does not require a new DNG spec version. Yes, it should work in any DNG processor that can deal with linearized DNGs (including backwards to ACR 2.4)".

Ian Lyons
"I can confirm what Thomas is telling you. There are some issues, but press the right buttons in ACR and they go away. It's pretty amazing going from CR2>ACR>CS2>PSD->Lightroom->DNG>ACR>CS2. The compression applied to PSD when converted to DNG is also impressive".

Those quotes reveal a paradigm-shift in the nature of raw conversion. Many people still think of raw converters primarily as software products responsible for transforming raw image data into a rectilinear array of RGB data, ready to be processed by a photo-editor. In other words, their differentiator is their ability and quality for "demosaicing" the output from a sensor using a CFA (colour filter array). But that view is out-of-date!

"Raw converters" are becoming "so-called raw converters", where the demosaicing is a relatively small part of the value of the product, and often "optional". When ACR handles a Linear DNG file, it doesn't demosaic raw image data, because there isn't any. Perhaps there once was, but this was done earlier, for example by DxO or by the DNG Converter. Or perhaps there never was raw image data, and the image data originated in a scanner, or a "paint" program. "ACR" stands for "Adobe Camera Raw", but sometimes "Raw", and even "Camera", are inaccurate!

When ACR handles a Linear DNG file, all of the tabs, sliders, and drop-down boxes still work, and do the sort of things expected of them. It is a digital image processor without any demosaicing to do, yet it is still useful. It can be used to set the white balance, correct for chromatic abberation, reduce noise, sharpen, apply a curve, etc. And that is true even if the "true" raw conversion was done before it was invoked, or was never needed because the image data didn't come from a digital camera, but perhaps started as a TIFF or a JPEG from some other source!

ACR and Lightroom are not the only examples. In principle, any product that can handle a Linear DNG file should be able to do the same. Some people believe that Silkypix is a good raw converter for Sigma/Foveon images. Convert them to DNG, and they think Silkypix then does the best job. But - a DNG from a Sigma/Foveon X3F is a Linear DNG! There never was a demosaicing task, because the Foveon sensor doesn't use a CFA. Any DNG converted from an X3F is a Linear DNG. So what is Silkypix doing? It is doing all sorts of image data processing, except for real "raw conversion"!

From DPReview:
What evidence is there that there is a "best way to de-mosiac a file for a given camera"? 
None. And never will be. Except maybe for "the best de-mosaic of the week". There are about 30+ different *good* demosaicing algorithms I know of. All of them are completely different, have different design goals and priorities. 

Support for new demosaicing algorithms while using older products

Here is an example of using older versions of ACR and Photoshop while still gaining the benefits of the latest demosaicing algorithms available to Adobe.

Thomas Knoll, talking about ACR 4.1:
One of the changes when I added official Fuji S5 support was to update the S/R blending algorithms for the S5 sensor. (The unofficial support was just using the S3 algorithms for the S5, which is not ideal since chip is slightly different).
To use these new algorithms with Camera Raw versions 2.4 through 3.7, use the free DNG Converter 4.1 to make "Linear" DNG files (not the normal raw DNG files). These Linear DNG files will be larger, but will have the updated SR blending logic "burned" into them, so 2.4 through 3.7 will be able to process them correctly.
ACR 4.1 has lots of other improvement, but this is a way to properly process Fuji S5 files in ACR 3.7 and ACR 2.4 within the limits of the feature set of these ACR versions.

The down side

If an image starts as a raw image from a digital camera, to become Linear DNG it must be "converted", typically "demosaiced". This may be done in Adobe's DNG Converter, or elsewhere, such as DxO. But once this conversion has been done, it is committed - whatever product processes the Linear DNG can't exploit its own, potentially unique, conversion(s).

This precludes conversion by more suitable algorithms, in other products, now or in the future. It makes sense to delay this conversion as long as possible. (And typically Raw DNG files are smaller than Linear DNG files).


Comparison with NEF and Nikon  Capture NX

There appear to be more similarities than differences between DNG and NEF, and between Lightroom (etc) and Nikon Capture NX. The NEF/Nikon world, and the DNG/everything-else world, appear to be following similar paths.

Ben Long
"You can output your images as TIFF, JPEG, or NEF files. The TIFF and JPEG files will be fully rendered; that is, Capture NX will apply all of your edits. However, when you next open the image, you won't be able to access any of your previous edits. To save your image with its edit list intact, you must save it as a NEF file".

"If you're like me, you probably thought that NEF was merely Nikon's format for its Raw files, but the spec is actually much more versatile than that. NEF files can include Raw data or regular TIFF-like data. In addition, Nikon can put its edit list (a small XML file) directly into the NEF format".

This is not saying that the user interface and the editing style are the same. NX clearly has some innovative editing methods. What this is saying is that the concept of having a powerful image processor, able to provide similar features on a whole range of source material, not just raw, and able to hold the results in a comprehensive file format, is similar. "Demosaicing" is becoming a less-significant, and sometimes even optional, part of the task.


Products that support Linear DNG

These tables identify some products known to support Linear DNG in some way. I don't have personal experience of all of these products. Please tell me of any errors or omissions, so that I can correct them.

Products from Adobe

Product Flow Comments
Photoshop CS + ACR 2.4 In This ACR reads Linear DNG. (So did ACR 2.3, but that is obsolete).
Bridge 1.0 + ACR 3.x In Out This ACR reads and (optionally) writes Linear DNG.
Bridge 2.0 (beta) + ACR 4.0 (beta) In Out This ACR reads and (optionally) writes Linear DNG. It can also create Linear DNG from images that originate as (8-bit or 16-bit) TIFF or JPEG.
Photoshop Elements + ACR 3.x In Out This ACR reads and (optionally) writes Linear DNG.
DNG Converter In Out All versions read and (optionally) write Linear DNG.
DNG SDK In Out Provides code to read and write all variants of DNG.
Lightroom (beta) In Out Lightroom reads and (optionally) writes Linear DNG. It can also create Linear DNG from images that originate as (8-bit or 16-bit) TIFF or JPEG or PSD.

Other products

These are simply examples. With more 200 products supporting DNG in some way, no-one knows all the products that support Linear DNG.

Product Flow Comments

dcraw + dcraw.exe build & MacOS X build + Archive for the 'dcraw' Category + DCRAW For Delphi + DCRAW2PS GUI

In

dcraw and derivatives not only read more than 200 native raw formats, but also read DNG files, both Raw DNG and Linear DNG.

DxO Optics Pro Out Since version 2.2, DxO has supported Linear DNG as an output file format.

Ichikawa Soft Laboratory - SILKYPIX® Developer Studio

In

Silkypix reads Linear DNG, with just a few restrictions.

IrfanView In IrfanView reads Linear DNG, perhaps because dcraw supports it.
Light Crafts - LightZone In

LightZone reads Linear DNG.

MediaChance - PhotoBrush In I discovered by accident that this supports Linear DNG.
ProFotoSoftware - PFS Batch Processor Pro In This provides raw conversion and image adjustments. It reads Linear DNG.
RAW Virtuoso In RAW Virtuoso reads Linear DNG.