[Digikam-users] Update embedded JPEG of RAW Files

Elle Stone ellestone at ninedegreesbelow.com
Mon Nov 3 10:54:02 GMT 2014

> On 11/02/2014 06:04 PM, GDoirat - GMail wrote:
>> Hello Everybody
>> I use Digikam to manage my photo database for many years.
>> With my first camera, i took my pictures in JPEG... Digikam was really
>> great.
>> I bought a SLR camera and started to took pictures in RAW.
>> I prefer to developpe my raw files in another software than digikam;
>> but i still really like photo database managment of DK. But preview of
>> raws are not updated when i do changes in the raw file (i'm using
>> darktable).
>> Is there a way (a software included or not in digikam) to update
>> embedded raws with exported jpeg from darktable in order that digikam
>> display a raw preview which includes changes done in darktable?
>> My search on web make me realised that Lightroom seems to be abble to
>> do that but i didn't succeed in finding a way to to that on linux.

Hmm, I have also wished that I could overwrite the embedded preview 
jpeg, and also always just assumed that you can't change the embedded 
preview jpeg.

But actually it turns out that you *can* overwrite the embedded preview 
using exiftool. It's a bit round about:

First develop the raw file.
Then save a copy of the developed raw file as a jpeg.
Then use exiftool to embed the "new preview" jpeg into the raw file, 
writing right over the top of the orginal embedded jpeg.

See this page:

/////// Quoting Phil (exiftool author) from the above link:
If I understand you correctly, you want to write same-named
JPEG images as the PreviewImage for a set of CR2 files.

exiftool "-previewImage<=JPGDIR/%f.jpg" -ext cr2 CR2DIR
/////// end quote

I tested the command and it does work. "JPGDIR" and "CR2DIR" need to be 
replaced with whatever directories the files are in (can be the same 

It probably wouldn't be too difficult to write a script to automate the 
process. Just make sure you test thoroughly on some throwaway images. I 
managed to mess up a raw file by running the command with the wrong syntax.

I believe your new preview image must have the same size (and possibly 
the same orientation) as the original preview, but I haven't confirmed.

I don't know which embedded file digiKam shows (there are several to 
choose from), but I will guess it's the previewImage.

Also see reading and writing examples from 

Not every camera raw file has exactly the same set of embedded images. 
For example, my canon raw files don't seem to have the "JpgFromRaw" that 
is referenced in the exiftool reading and writing examples.


More information about the Digikam-users mailing list