Is there a preview image in iphone RAW(DNG) file?

Started by namer900, December 24, 2016, 01:21:39 AM

Previous topic - Next topic

Phil Harvey

#15
@Hayo:  I have uploaded a 10.38 pre-release here.  So far the testing has been going well, but I would be happy if you want to try it out.

- Phil

(note that the ExifTool web server is scheduled for some system updates today, which may result in some down time)
...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 ($).

Hayo Baan

Quote from: Phil Harvey on January 02, 2017, 08:13:07 AM
@Hayo:  I have uploaded a 10.38 pre-release here.  So far the testing has been going well, but I would be happy if you want to try it out.

Nice, the previews are now reported inside their own group and can be extracted from there  8)

What doesn't seem to work yet though is the ability to see/extract the "other" embedded images. I still only get the "normal" previews (from the makernotes and subifd1, as well as the jpg from raw in subifd2), but not the additional images in SubIFD3 and SubIFD4 :(

P.S. I noticed you changed the composite tag Lens into Lens Spec?
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

Hi Hayo,

Thanks for testing this.

Those things in SubIFD3 and SubIFD4 are not JPEG images.  I don't know what they are.  They are structured like a JPEG, but don't contain a viewable image.

Yes, I changed the LensSpec description from "Lens" to "Lens Spec".  Does that affect you at all?

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

Hayo Baan

Quote from: Phil Harvey on January 02, 2017, 09:42:02 AM
Thanks for testing this.
You're welcome!

Quote from: Phil Harvey on January 02, 2017, 09:42:02 AM
Those things in SubIFD3 and SubIFD4 are not JPEG images.  I don't know what they are.  They are structured like a JPEG, but don't contain a viewable image.
Those are added when you enable "add fast load data" when creating DNGs. It's a real pity they don't contain any viewable data :(
(but is it extractable in case there is a way to turn that data into something useful?)

As I mentioned, I actually would like to get rid of them; they take up quite some space and I don't think they are actually really useful other than perhaps for Lightroom (?) (which I don't really use anyway: I like Camera Raw much better).

I hope removing these additional SubIFDs is going to be possible (happy to help testing code for you for this ;))

Quote from: Phil Harvey on January 02, 2017, 09:42:02 AM
Yes, I changed the LensSpec description from "Lens" to "Lens Spec".  Does that affect you at all?

Ah, right, I see, so you didn't change the name of the tag, just the description. In that case it doesn't affect me at all (besides, the new description is actually clearer and closer to the name of the tag).

Cheers,
Hayo
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

Quote from: Hayo Baan on January 02, 2017, 10:37:17 AM
Those are added when you enable "add fast load data" when creating DNGs. It's a real pity they don't contain any viewable data :(
(but is it extractable in case there is a way to turn that data into something useful?)

I'll have to look into this.

QuoteAs I mentioned, I actually would like to get rid of them; they take up quite some space and I don't think they are actually really useful other than perhaps for Lightroom (?) (which I don't really use anyway: I like Camera Raw much better).

I hope removing these additional SubIFDs is going to be possible (happy to help testing code for you for this ;))

I'll put this on the to-do list, but again it will take some thought because it is potentially dangerous.

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

Phil Harvey

I have found a potential problem in the pre-release with identification of some embedded images.  The web server is down for maintenance at the moment, so I'll have to update the uploaded version later.  I'll post again here when the updated version is available.

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

Phil Harvey

I have updated the 10.38 pre-release with a fixed version.  The change only affects the NRW file type.

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

Hayo Baan

Updated, but as I don't have NRW files this didn't affect me :)
Hayo Baan – Photography
Web: www.hayobaan.nl

namer900

I updated to the new 10.38 version, and done some testing. The PreviewImage extracting works perfectly. However, I have a question regarding writing/replacing the PreviewImage.

In windows 10, its "File Explorer" can display the original iPhone DNG's thumbnail, and its "Photos app" can open/view the DNG. But after I replaced the PreviewImage of the DNG with ExifTool, "File Explorer" can't display the new DNG's thumbnail anymore, and the "Photos App" can't open/view the new DNG(error message-"It looks like we don't support this file format.")

My test files:
https://1drv.ms/u/s!ApWbHSC9NoYSgns0p2UsyEk2p1x7

Thanks

Phil Harvey

I can't test in Windows, but the DNG you uploaded (zz.DNG) displays fine in Apple Preview and Adobe Lightroom 5.

I'll look into trying this in Windows on Monday.

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

Hayo Baan

I can't test this on Windows either (and on a Mac everything seems to work well), but one thing I can think of is the fact the JPG you used as replacement preview image contained metadata. Perhaps if you remove all metatdata before using it as replacement it will work?

You can remove all metadata using exiftool -all= FILE

Note: as on a Mac e.g. the Preview application renders the original raw data in the file, I replaced the preview with one that was completely different. That way it was clearer to me when the preview image got used and when the raw data. But the conclusion was the same: it works fine under Mac OS. I tried Finder (=Explorer on Windows), Adobe Camera Raw (and thus Lightroom), Bridge, Preview, and PhotoMechanic. The results where as expected: thumbnail in Finder was my replacement preview, PhotoMechanic always used my replacement preview, and everywhere else the original raw is used.
Hayo Baan – Photography
Web: www.hayobaan.nl

namer900

Thanks for the suggestion! I removed the metadata of the JPG, but it's still not working.
My files:
https://1drv.ms/u/s!ApWbHSC9NoYSgnzqdLHCgm9zlRYO

To be sure, the new DNG is working everywhere else I tried, just not working in windows 10 native environment (by that I mean no other third-party raw codecs installed, like "adobe dng codec", "FastPictureViewer codec" etc.). If I placed the original DNG on windows 10 desktop, its thumbnail will automatically displayed. If I double click the file, it will be opened in "Microsoft Photos" app. The new DNG can't be opened and its thumbnail won't shown.

Hayo Baan

Another thought: since you replaced the original preview with a much higher resolution version, the recorded width and height of the embedded image are no longer correct. So perhaps it is only a matter of correcting those.

In the sample case this would mean running exiftool -EXIF:IFD0:ImageWidth=4032 -EXIF:IFD0:ImageHeight=3024 zz.DNG.

Hope this works!
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

OK.  I tried this on my Windows 10 and it won't event display a preview of the original DNG (even after I renamed it back to .DNG again).  And I don't have Windows Photo and don't want to install it on my clean Windows 10 system, so it looks like I won't be able to reproduce this problem.

But I have an idea:

Try writing the original preview back to the modified DNG to see if this works.  This will tell you if it is the preview itself that is a problem, or if it is due to a change in the structure of 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 ($).

namer900

Thanks hayo, phil for the ideas!

After I further process the modified DNG(which embedded with a no metadata jpg) with exiftool -EXIF:IFD0:ImageWidth=4032 -EXIF:IFD0:ImageHeight=3024 zz.DNG
the resulting DNG still not working. Interestingly, if I try to open it with "Photos App", the error message is changed from "It looks like we don't support this file format."(for the modified DNG) to "We can't open this file."(for the further processed DNG).

"Writing the original preview back to the modified DNG" will result in a working DNG again, just like the original DNG(thumbnail displaying in win10, and can be opened in "Photos App").