Embed an existing JPG into a DNG file as the preview image

Started by ziggo, January 22, 2014, 12:48:46 PM

Previous topic - Next topic

ziggo

From another forum I understood I can embed a preview image in a raw file using the following code:
exiftool '-previewImage<=IMG_1111.jpg' IMG_1111.arw
The poster tried this on Linux and it worked for him/her.

I'm a Mac and a couple of months ago I installed Exiftool via the package provided here: http://www.exiftool.org/index.html
I'm not sure which version I have.

When I try out the suggested code with a DNG file like this:
exiftool '-previewImage<=IMG_5413.JPG' IMG_5413.DNG

It doesn't work and returns:

0 image files updated
1 image files unchanged


Running exiftool --help shows that both the ARW and DNG file format can be read and written to by Exiftool.

Why doesn't it work for me with the DNG file?

The DNG file is created on a Canon Powershot A550 using the CHDK firmware. The JPG image originates from the same camera.

Phil Harvey

If the DNG has a PreviewImage that ExifTool can extract, then you should be able to write it:

exiftool "-previewimage<=preview.jpg" some.dng

But ExifTool will not create a PreviewImage if it doesn't already exist in the DNG.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ziggo

The thing is that the DNG doesn't have a previewImage to begin with. That's why I'm trying to add it using an existing JPG. I wasn't aware that it was a requirement to already have a previewImage field before something can be written to it.

Is it possible to create a previewImage field and then write the JPG to it?

I've tried the code you provide and it doesn't do anything.

Phil Harvey

The problem is that ExifTool will not modify the directory structure of a TIFF-format image, and you must create a new image file directory in the TIFF (DNG) for the preview.  So you can't use ExifTool to do this.

I would look to an Adobe utility for this functionality.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ziggo

Thank you for your fast reply.

I've used Lightroom successfully to embed a preview image in a DNG file without one, but it takes about 2-3 seconds for each. When I have a hundreds of these DNG files for a time-lapse video it can take a long time before all have a preview image appended.

I hoped a command line tool would speed up the process, but it looks I'm out of luck.