ExifTool Forum

General => Metadata => Topic started by: blue-j on September 21, 2022, 10:54:20 PM

Title: Apple ProRAW
Post by: blue-j on September 21, 2022, 10:54:20 PM
You may have heard of Apple ProRAW?  It's what Apple is calling a flavor of DNG that includes some of their computational photography data in it.

https://support.apple.com/en-us/HT211965

Here's a sample from an iPhone 12 Pro:

https://www.dropbox.com/s/cd6vqi4c4llk5bn/IMG_1078.DNG?dl=0 (https://www.dropbox.com/s/cd6vqi4c4llk5bn/IMG_1078.DNG?dl=0)

I am wondering how to accurately identify Apple ProRaw, since it is not actually a new format per se.  I presume a composite tag, but which fields?  Has anyone already played with this?

- J
Title: Re: Apple ProRAW
Post by: Joanna Carter on September 22, 2022, 05:34:34 AM
One thing I have gathered is that it is not a true RAW file, because it is processed as soon as it is taken for things like HDR, DoF, etc. So, it seems to be a DNG container with all sorts of "stuff" as well as the image data, but definitely not not a data mosaic that we would expect from a "real" camera.
Title: Re: Apple ProRAW
Post by: blue-j on September 22, 2022, 01:02:36 PM
I agree.  It is actually seems to be quite malformed.  It has masks and depth maps not even noticed as unknown binaries by ExifTool, for example, it seems to me?  Sigh.  Apple seems to have given us a Rubik's Cube.
Title: Re: Apple ProRAW
Post by: StarGeek on September 22, 2022, 01:03:24 PM
There is a bunch of unknown Apple tags in that sample.  That might be worth checking out.

[Apple]        Apple_0x0001                    : 14
[Apple]        RunTimeFlags                    : Valid
[Apple]        RunTimeValue                    : 123604210936666
[Apple]        RunTimeScale                    : 1000000000
[Apple]        RunTimeEpoch                    : 0
[Apple]        Apple_0x0004                    : 1
[Apple]        Apple_0x0005                    : 183
[Apple]        Apple_0x0006                    : 258
[Apple]        Apple_0x0007                    : 1
[Apple]        AccelerationVector              : -0.9363008146 0.06306845697 -0.3137552441
[Apple]        FocusDistanceRange              : 0.50 - 0.62 m
[Apple]        Apple_0x000d                    : 35
[Apple]        Apple_0x000e                    : 0
[Apple]        Apple_0x0010                    : 1
[Apple]        Apple_0x0014                    : 12
[Apple]        Apple_0x0019                    : 73728
[Apple]        Apple_0x001a                    : q750n
[Apple]        Apple_0x001f                    : 0
[Apple]        Apple_0x0020                    : D17D47D9-C3F5-4F8D-A55D-31AAA2EFFF2D
[Apple]        Apple_0x0021                    : 0.8432090282
[Apple]        Apple_0x0023                    : 153 268435468
[Apple]        Apple_0x0026                    : 3
[Apple]        Apple_0x0027                    : 28.07955743
[Apple]        Apple_0x002b                    : 40E69D4E-B0AE-4E06-BC53-A967C4237B90
[Apple]        Apple_0x002d                    : 4852
[Apple]        Apple_0x002e                    : 1
[Apple]        Apple_0x002f                    : 70
[Apple]        Apple_0x0030                    : 0
[Apple]        Apple_0x0033                    : 12288
[Apple]        Apple_0x0034                    : 4
[Apple]        Apple_0x0035                    : 3
[Apple]        Apple_0x0036                    : 223
[Apple]        Apple_0x0037                    : 6
[Apple]        Apple_0x0038                    : 155
[Apple]        Apple_0x0039                    : 2
[Apple]        Apple_0x003a                    : 4
[Apple]        Apple_0x003b                    : 0
[Apple]        Apple_0x003c                    : 4
[Apple]        Apple_0x003d                    : 50
[Apple]        Apple_0x0041                    : 0
[Apple]        Apple_0x0042                    : 0
[Apple]        Apple_0x004a                    : 3
Title: Re: Apple ProRAW
Post by: blue-j on September 22, 2022, 01:16:27 PM
Apple 0x0002
Apple 0x003e

are the only ones that look binary.

This is vexing:    [minor] Bad format (16) for MakerNotes entry 13

I'm afraid we are quickly into Phil territory here.

- J

Title: Re: Apple ProRAW
Post by: blue-j on September 22, 2022, 01:17:21 PM
Mr Stargeek, I think you did not list them because of -u vs -U   - J
Title: Re: Apple ProRAW
Post by: Phil Harvey on September 22, 2022, 02:19:50 PM
Quote from: blue-j on September 22, 2022, 01:16:27 PMThis is vexing:    [minor] Bad format (16) for MakerNotes entry 13

Interesting.  Apple is using a BigTIFF format code in their maker notes now.  This represents an unsigned 64-bit integer.  Hmmm.  I'll add support for this in version 12.46.

Other than possibly unknown Apple information this looks like a regular DNG to me.  But it does seem to contain depth map data, or whatever this means:

Portrait Effects Matte Version  : 65537
Auxiliary Image Sub Type        : portraiteffectsmatte
Auxiliary Image Type            : depth
Semantic Segmentation Matte Version: 65536
Auxiliary Image Type            : urn:com:apple:photo:2019:aux:semanticskinmatte

- Phil
Title: Re: Apple ProRAW
Post by: blue-j on September 22, 2022, 08:22:30 PM
It's the depth map grayscale matte used for their Portrait mode.  I dont see the binary data though, anywhere.  - J
Title: Re: Apple ProRAW
Post by: blue-j on September 22, 2022, 10:33:39 PM
Adobe is recognizing it in ACR 14.5 (see attached). They have XMP files in /Library/Application\ Support/Adobe/CameraRaw/Settings/Apple that seem to identify Apple ProRAW and assign images default XMP CRS values.  It's something to go on...?

- J

Title: Re: Apple ProRAW
Post by: blue-j on September 24, 2022, 02:52:52 PM
In my research I found this to be one of the best resources:

https://lux.camera/understanding-proraw/

-J
Title: Re: Apple ProRAW
Post by: blue-j on September 25, 2022, 06:06:47 PM
A key field for Apple ProRAW DNGs (note, for once something not proprietary from Apple!) is:

0xcd2d   ProfileGainTableMap   undef!   SubIFD

In the link above:

"Apple worked with Adobe to introduce a new type of tag into the DNG standard, called a 'Profile Gain Table Map.' This data gives your editor everything it needs to know to tone map your photo image and end up with results identical to the first party camera. Because it's separate data, you can turn down its strength, or turn it off completely."

I wonder what it might take to support parsing this field?  It is beyond my powers so I have no real way to gauge the effort.  It does appear to be well specified in the 1.6 DNG spec, p69 as written at the bottom of the page.  I surely know the list is long....!

- J

Title: Re: Apple ProRAW
Post by: Hagen on February 01, 2023, 04:35:37 PM
Quote from: Phil Harvey on September 22, 2022, 02:19:50 PM
Quote from: blue-j on September 22, 2022, 01:16:27 PMThis is vexing:    [minor] Bad format (16) for MakerNotes entry 13

Interesting.  Apple is using a BigTIFF format code in their maker notes now.  This represents an unsigned 64-bit integer.  Hmmm.  I'll add support for this in version 12.46.

Other than possibly unknown Apple information this looks like a regular DNG to me.  But it does seem to contain depth map data, or whatever this means:

Portrait Effects Matte Version  : 65537
Auxiliary Image Sub Type        : portraiteffectsmatte
Auxiliary Image Type            : depth
Semantic Segmentation Matte Version: 65536
Auxiliary Image Type            : urn:com:apple:photo:2019:aux:semanticskinmatte

- Phil

Hi Phil,

I am wondering if it's possible to extract those semantic images as well? I know the preview image can be exported, but couldn't figure out how to get the semantic images (depth map, sky matte, skin matte, etc).

Best,
Hagen
Title: Re: Apple ProRAW
Post by: Phil Harvey on February 02, 2023, 09:00:49 AM
Hi Hagen,

These do seem to be stored in JPEG format, so I'll add the ability to extract these in ExifTool 12.56.  They will appear like this:

> exiftool test.dng -otherimage -a -G1
[SubIFD1]       Other Image                     : (Binary data 84667 bytes, use -b option to extract)
[SubIFD2]       Other Image                     : (Binary data 45291 bytes, use -b option to extract)

- Phil