Author Topic: Embed an existing JPG into a DNG file as the preview image  (Read 2156 times)

ziggo

  • Newbie
  • *
  • Posts: 3
Embed an existing JPG into a DNG file as the preview image
« on: January 22, 2014, 12:48:46 PM »
From another forum I understood I can embed a preview image in a raw file using the following code:
Code: [Select]
exiftool '-previewImage<=IMG_1111.jpg' IMG_1111.arwThe 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:
Code: [Select]
exiftool '-previewImage<=IMG_5413.JPG' IMG_5413.DNG
It doesn't work and returns:
Code: [Select]
0 image files updated
1 image files unchanged

Running
Code: [Select]
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16909
    • ExifTool Home Page
Re: Embed an existing JPG into a DNG file as the preview image
« Reply #1 on: January 22, 2014, 12:58:07 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ziggo

  • Newbie
  • *
  • Posts: 3
Re: Embed an existing JPG into a DNG file as the preview image
« Reply #2 on: January 22, 2014, 01:01:05 PM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16909
    • ExifTool Home Page
Re: Embed an existing JPG into a DNG file as the preview image
« Reply #3 on: January 22, 2014, 01:04:03 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ziggo

  • Newbie
  • *
  • Posts: 3
Re: Embed an existing JPG into a DNG file as the preview image
« Reply #4 on: January 22, 2014, 01:08:26 PM »
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.