Unable to update `DNG files generated by Photoshop

Started by JobWellDone, July 31, 2023, 11:16:02 AM

Previous topic - Next topic

JobWellDone

When i generate DNG by Photoshop or Adobe DNG Converter then i am not able to update the embedded preview JPG inside the DNG.

If i use third party tool like RAW2DNG on Android then i am able to update embedded preview JPG.

ExifTool v12.64

StarGeek

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

JobWellDone

#2
Quote from: StarGeek on July 31, 2023, 01:57:57 PMCan you share a sample problem file?
https://www.upload.ee/files/15521248/20221112_225418.zip.html

Try importing preview from JPG file provided alongside the DNG

exiftool -"previewImage<=%d%f.jpg" -overwrite_original -progress "20221112_225418.dng"
it says "1 image files updated", but preview stays the same.

StarGeek

What are you using to view the preview image with?
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

JobWellDone

Quote from: StarGeek on July 31, 2023, 03:53:11 PMWhat are you using to view the preview image with?
I've tried XnView MP, IfranView, FastStone Image Viewer. None show updated preview, but old one.

StarGeek

With Irfanview, I cannot find any option to read the preview image.  In the thumbnail viewer, there is an option to read the ThumbnailImage in jpegs, but I can't find anything else.  It only reads the much smaller ThumbnailImage.

In XNView, it will read the JpgFromRaw to show a thumbnail, and displayed the new thumbnail the moment exiftool finished rewriting the file.

Do you any images where your programs are reading a PreviewImage that is already different?  It's quite probably that are simply reading either of the above tags or are reading the whole file for the displayed thumbnail.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

JobWellDone

Quote from: StarGeek on August 02, 2023, 01:40:41 PMWith Irfanview, I cannot find any option to read the preview image.  In the thumbnail viewer, there is an option to read the ThumbnailImage in jpegs, but I can't find anything else.  It only reads the much smaller ThumbnailImage.

I never seen a thumbnail viewer inside IrfanView, i was talking about preview shown once you open DNG file in full screen mode.



Notice in bottom right corner size of image is 4032 x 3024, its preview embedded in DNG by photoshop, not a DNG image.

For FastStone Image Viewer it does not load raw image in full screen view, only uses embedded JPG unless you press "A" button on keyboard only then it will load raw image.

FastStone DNG embedded JPEG view


FastStone DNG RAW view



Quote from: StarGeek on August 02, 2023, 01:40:41 PMIn XNView, it will read the JpgFromRaw to show a thumbnail, and displayed the new thumbnail the moment exiftool finished rewriting the file.
Could you tell me what version of XnView are you using and what command line you used to update JPEG preview? Can you upload final DNG file somewhere for me to test?

Quote from: StarGeek on August 02, 2023, 01:40:41 PMDo you any images where your programs are reading a PreviewImage that is already different?  It's quite probably that are simply reading either of the above tags or are reading the whole file for the displayed thumbnail.
Sorry i can't understand what you mean.

StarGeek

Quote from: JobWellDone on August 03, 2023, 10:31:50 AMI never seen a thumbnail viewer inside IrfanView,

Hit T or this menu


QuoteNotice in bottom right corner size of image is 4032 x 3024, its preview embedded in DNG by photoshop, not a DNG image.

I assume you mean bottom left.  But I can't find anything that indicates that the image is anything other than 4032x3024.  Even loading the image into Adobe Bridge says the dimensions are 4032x3024.

I normally have Irfanview set to always show the actual RAW, but when I went in to change that, Options Menu->Properties/Settings->Plugins->Try to load embedded preview image, Irfanview would display the JpgFromRaw, not the PreviewImage or the ThumbnailTIFF in the image.

Of note is that even with Try to load embedded preview image enabled, Irfanview's thumbnail viewer still displayed the correct image, not either of the previews.

QuoteCould you tell me what version of XnView are you using and what command line you used to update JPEG preview? Can you upload final DNG file somewhere for me to test?

XnView MP Windows
Version 0.93.1 64bits (Mar 6 2019)

Here is how XnView displays the images


I used your same command line, just swapping PreviewImage for JpgFromRaw

As a more complete version, here I embedded an image into PreviewImage and JpgFromRaw (ThumbnailTIFF is not writable).  The embedded images are mirrors of each other, so it's more obvious which is which, though in Irfanview's case, it applies the Orientation of the DNG to the embedded image.


The command was
exiftool -P -overwrite_original "-previewImage<=Y:\!temp\ddd\PreviewImage.jpg" "-JpgFromRaw<=Y:\!temp\ddd\JpgFromRaw.jpg" "-ThumbnailImage<=Y:\!temp\ddd\ThumbNail.jpg" Y:\!temp\ddd\20221112_225418.dng

Here's the altered copy I made.

Quote
Quote from: StarGeek on August 02, 2023, 01:40:41 PMDo you any images where your programs are reading a PreviewImage that is already different?  It's quite probably that are simply reading either of the above tags or are reading the whole file for the displayed thumbnail.
Sorry i can't understand what you mean.

What I'm saying is that you are jumping to the conclusion that your programs are only reading the PreviewImage.  Has one of your programs created a file in which the thumbnail image is different from the actual image?

Metadata is a hot mess and you can never assume that just because a program uses a certain name for a piece of metadata, that that is the actual name of the tag.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

JobWellDone

Thanks, using
exiftool -"JpgFromRaw<=%d%f.jpg" -overwrite_original -progress "20221112_225418.dng"instead of
exiftool -"previewImage<=%d%f.jpg" -overwrite_original -progress "20221112_225418.dng"worked and updated updated preview JPEG properly inside DNG file.

What's the difference between JpgFromRaw and PreviewImage i am unable to find any reference in documentation?

Phil Harvey

Raw files may contain multiple embedded JPG's of varying sizes.  Generally, ExifTool calls the large one JpgFromRaw, the medium-sized ones PreviewImage, and the small ones ThumbnailImage, but this isn't a firm rule.

- 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 ($).

JobWellDone

#10
How can i extract preview from this DNG file doing either
exiftool -previewimage -b -w! .jpg IMG_20230723_232913.dng  
exiftool -JpgFromRaw -b -w! .jpg IMG_20230723_232913.dng
exiftool -a -b -W %d%f_%t%-c.%s -preview:all IMG_20230723_232913.dng
Saves nothing, and i am sure there is preview inside it.

Source file: https://www.upload.ee/files/15546701/IMG_20230723_232913.zip.html

When i check Exif info on this file it reports:

[EXIF:Image]    Compression                    : JPEG
[EXIF:Image]    TIFF-EP Standard ID            : 1 0 0 0
[EXIF:Image]    DNG Version                    : 1.4.0.0
[EXIF:Image]    DNG Backward Version           : 1.1.0.0


So the file is already compressed.

For some reason file is 6.5 MB out of the device, when i run Adobe DNG Converter on it it becomes 9.1 MB, android phone that made this DNG file compressed it better than Adobe DNG Converter can do, how's that even possible?


Quote from: Phil Harvey on August 04, 2023, 08:53:05 PMRaw files may contain multiple embedded JPG's of varying sizes.  Generally, ExifTool calls the large one JpgFromRaw, the medium-sized ones PreviewImage, and the small ones ThumbnailImage, but this isn't a firm rule.

- Phil

Good to know, thanks Phil


Phil Harvey

#11
If any preview (or thumbnail or jpgfromraw) is available, this command will tell you (they are all in the "Preview" group):

exiftool -preview:all FILE

But the DNG you uploaded has no previews.

- Phil

Edit:  It is likely that the DNG converter is adding a preview.  The DNG Converter has settings for the preview image size.
...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 ($).