ExifTool Forum

General => Metadata => Topic started by: Sheridan on March 29, 2018, 11:32:54 PM

Title: Writing a thumbnail jpg to a raw (Nef) file Problem
Post by: Sheridan on March 29, 2018, 11:32:54 PM
I am trying to write a jpg (160W x 120H) to a Nikon raw file from Windows  :(using the command
exiftool "-ThumbnailImage<=thumb.jpg" photo.nef

The command fails with two lines (sorry, forget the exact) about 1 image not updated, 1 image not changed. This doesn't tell me why it is failing hence my questions.
1. Can exiftool write thumbnails to Nikon raw files?
2. Is my command incorrect?
3. Thumbnail size was determined by reading out a thumbnail and checking WxH pixels.
4. Some other question that I can't ask Becuase I don't know enough about raw files and exiftool to know to ask?

Regards
Sher
Title: Re: Writing a thumbnail jpg to a raw (Nef) file Problem
Post by: Phil Harvey on March 30, 2018, 09:19:32 AM
Hi Sher,

NEF file do not contain a ThumbnailImage, so what you are trying to do won't work.

They do contain a PreviewImage, which is somewhat larger, but writable by ExifTool.

- Phil
Title: Re: Writing a thumbnail jpg to a raw (Nef) file Problem
Post by: Sheridan on March 30, 2018, 12:59:05 PM
Ooo boy. Now I'm t really confused.
I used the exiftool  -a -b -W %d%f_%t%-c. %s -preview:all photo.nef command to produce the image files so I could figure out what size each should be if I were to create a replacement to overwrite the existing one.
The command produced 3 files :
Thumbnail.tiff         160W x 120H
PreviewImagejpg    570W x 375H
JpgFromRaw.jpg     3872W x 2592H

And accounting for the. tiff as the thumbnail (not jpg) I can't write it back as.tiff or .tif. It says it is not valid image for Canon or Olympus thumbnail.

So... Why do I get a thumbnail out at all. I'm confused.

Sher
Title: Re: Writing a thumbnail jpg to a raw (Nef) file Problem
Post by: Phil Harvey on March 30, 2018, 01:39:03 PM
Hi Sher,

Oh.  ThumbnailTiff.  That's very different.  Unfortunately ExifTool doesn't have the ability to write this.  (See the Composite tags documentation.)

I think your command would produce ThumbnailTIFF.tiff, not Thumbnail.tiff

- Phil
Title: Re: Writing a thumbnail jpg to a raw (Nef) file Problem
Post by: Sheridan on March 30, 2018, 02:52:23 PM
I believe you are correct on the tiff.tiff naming.

Playing around further it appears that with the jpgfromraw I can get development changes in darktable to show in digiKam which was the point of my efforts. Of course I'm left with questions like who uses the nef thumbnail? Why tiff since it is such a small file and the others are jpg? Programs that display "thumbnails" may not be displaying the photos "thumbnail" file - why? And many more once I think about it for a bit.

Thank you for your help. Knowing what is supposed to happen saves a lot of time.

Are there any plans to have exiftool write the tiff thumbnail?

What is your understanding of how it is intended that programs use the 3 embedded files? Or was there never any consensus and they were simply provided because?

Once again, thanks. And you've written a really useful tool that saves so much effort.

Best
Sher
Title: Re: Writing a thumbnail jpg to a raw (Nef) file Problem
Post by: Sheridan on March 30, 2018, 10:10:22 PM
Hi Phil;

One other question.

I was carefuly verifying my process and I noticed that when I executed the:

exiftool "-JpgFromRaw<=NewThumb.jpg" photo.NEF

The photo.NEF is renamed to photo.NEF_original and a second file with the same name shows in Windows file explorer. I'm not even sure how Windows manages to allow 2 files of the same name and size to exist.

Other than Chrome and file explorer no other programs are running.

Any ideas what is happening?
Title: Re: Writing a thumbnail jpg to a raw (Nef) file Problem
Post by: StarGeek on March 30, 2018, 10:37:17 PM
From the docs https://exiftool.org/exiftool_pod.html
" By default the original files are preserved with _original appended to their names"

To prevent this, add  -overwrite_original to your command
Title: Re: Writing a thumbnail jpg to a raw (Nef) file Problem
Post by: Sheridan on March 30, 2018, 10:57:26 PM
Thank you.

I've read through the document but forgot, missed, whatever that option. Sorry about that. I'll spend more time checking documentation in the future.

Sher