Jump to content

Extract embedded JPG from DNG


garygraphy

Recommended Posts

Time ago, for my curiosity, did download and read the complete specs of the DNG file (being an "open" standard, one can find them in the Adobe ecosystem) ... indeed, I seem to remember that (apart the "thumbnail") it anyway has inside, somewhere, also a std jpeg full res... but of course it would be not easy to extract a usable jpg file from... a very deep-level binary file manipulation program which, during development, can deserve any kind of surprise... don't see the reason to embark in such job, apart enjoiying a fine exercise of programming (but in this sense it would be more fun/interesting to write a program to extract YOUR OWN jpg from the native DNG data...playing with color tables etc... just to compare it with the std DNG+JPG output :) )

Link to post
Share on other sites

Get EXIFtool. 

Run from a command line "exiftool -s -s {filename}.dng > {filename}_EXIF.txt" 

 

In the .txt file you just made, you'll see the appropriate section of the DNG file that contains the preview JPEG data and the command required to extract that preview JPEG data into a file. 

Link to post
Share on other sites

Get EXIFtool. 

Run from a command line "exiftool -s -s {filename}.dng > {filename}_EXIF.txt" 

 

In the .txt file you just made, you'll see the appropriate section of the DNG file that contains the preview JPEG data and the command required to extract that preview JPEG data into a file. 

 

Useful tool in many ways.

Link to post
Share on other sites

Advertisement (gone after registration)

The DNG files from the Leica M10 include two JPEG preview images, a thumbnail named "JpgFromRaw" (160 × 120 pixels) and a medium-sized one named "PreviewImage" (1440 × 960 pixels). As far as I can tell, a full-sized JPEG image is not included.

 

To extract, use

 

exiftool -b -JpgFromRaw {filename}.DNG >{filename}.JPG

 

or

 

exiftool -b -PreviewImage {filename}.DNG >{filename}.JPG

Link to post
Share on other sites

The DNG files from the Leica M10 include two JPEG preview images, a thumbnail named "JpgFromRaw" (160 × 120 pixels) and a medium-sized one named "PreviewImage" (1440 × 960 pixels). As far as I can tell, a full-sized JPEG image is not included.

 

To extract, use

 

exiftool -b -JpgFromRaw {filename}.DNG >{filename}.JPG

 

or

 

exiftool -b -PreviewImage {filename}.DNG >{filename}.JPG

Correct. It is not included unless you set the camera for RAW + Jpeg.

Link to post
Share on other sites

Sandy McGuffog put up a simple utility called DNG Cleaner on the Apple store which 

 

1. Removes any XMP information, including Lightroom/ACR settings
2. Removes any Lightroom/ACR profile information. (AKA non-embedded profiles)
3. Optionally removes any opcodes  (e.g. for distortion correction, which LightRoom applies automatically
4. Deletes any existing preview images, and regenerates a “standard” set
5. Optionally compresses the image data.
 
and claims that he sees shrinkages on the order of 3MB per file from steps 1-4.  I have seen full sized jpegs incorporated, but since I don't have an M10 myself, I don't know if this was a side effect of outputting DNG + JPG.  I presume it is there to allow checking focus and sharpness after the shot is taken.
Link to post
Share on other sites

Technically, what the M10 DNG looks like is as below.

 

So you need an app that can can extract IFD0, subIFD 1

 

-----------------------------------------

 

IFD 0: Offset = 12, Entries = 49

 

NewSubFileType: Main Image

ImageWidth: 5984

ImageLength: 3992

 

SubIFD 1: Offset = 918, Entries = 12

 

NewSubFileType: Preview Image

ImageWidth: 5952

ImageLength: 3968

 

SubIFD 2: Offset = 768, Entries = 12

 

NewSubFileType: Preview Image

ImageWidth: 1440

ImageLength: 960

 

SubIFD 3: Offset = 618, Entries = 12

 

NewSubFileType: Preview Image

ImageWidth: 160

ImageLength: 120

Link to post
Share on other sites

The DNG files from the Leica M10 include two JPEG preview images...

Hmmm... this (as far as I remember) is just you find from a quick analisys... I don't remember well (made my analisys of the DNG specs years ago.. at "M8 times") but the thumbnail data derived from a first jpg processing which was somewhere embedded within the DNG derived data... and you could find (didn'try, indeed) the way to extract them to obtain a full res jpg... (but... it was 2008 or 2009... haven't even saved my exercises...)

Link to post
Share on other sites

The M10 DNGs differ in quite a few ways from the M9 and M240's.  To start with, they are created with DNG protocol 1.4 which allows a few more embedded types of information that any program should be able to read.  There are also embedded Adobe templates, initialized with null or no values, that provide a framework for Lightroom users to insert their development profiles in the raw file.  I suppose this replaces "sidecar" files, but since I am not a LR user, it is wasted on me.

 

scott

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...