ExifTool Forum

General => Metadata => Topic started by: OverDrive on October 26, 2020, 10:37:00 AM

Title: How Could I extract MPF images (HDR gain Map) from iPhone's jpegs?
Post by: OverDrive on October 26, 2020, 10:37:00 AM
Hello, guys!

I tried:
exiftool.exe -s C:\Users\Administrator\Downloads\IMG_3349.JPG and it tells me that there is MPImage2 as aux image in the file:
---- MPF ----
MPF Version                     : 0100
Number Of Images                : 2
MP Image Flags                  : (none)
MP Image Format                 : JPEG
MP Image Type                   : Baseline MP Primary Image
MP Image Length                 : 3601114
MP Image Start                  : 0
Dependent Image 1 Entry Number  : 0
Dependent Image 2 Entry Number  : 0
MP Image Flags                  : (none)
MP Image Format                 : JPEG
MP Image Type                   : Undefined
MP Image Length                 : 117885
MP Image Start                  : 3601114
Dependent Image 1 Entry Number  : 0
Dependent Image 2 Entry Number  : 0
MP Image 2                      : (Binary data 117885 bytes, use -b option to extract)
MPF Version                     : 0100
Number Of Images                : 2

Then I used
exiftool.exe -MPImage2 -b IMG_3349.JPG > 1.jpg
But I got a 163364 bytes file and could not be open as an Image.
What was wrong here?
Thanks
Title: Re: How Could I extract MPF images (HDR gain Map) from iPhone's jpegs?
Post by: OverDrive on October 26, 2020, 10:55:18 AM
I just found this page but I did not find an error of my command.
https://exiftool.org/forum/index.php?topic=11511.msg61693#msg61693

"And I can extract the data easily using:
Code: [Select]
exiftool -b -MPImage2 test-lumen.jpg > depthMap.jpg"
Title: Re: How Could I extract MPF images (HDR gain Map) from iPhone's jpegs?
Post by: StarGeek on October 26, 2020, 11:18:28 AM
I'm not too familiar with depth maps, but looking at your attached file, it has XMP code as it's header. 
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 6.0.0">
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description rdf:about=""
            xmlns:HDRGainMap="http://ns.apple.com/HDRGainMap/1.0/"
            xmlns:apdi="http://ns.apple.com/pixeldatainfo/1.0/">
         <HDRGainMap:HDRGainMapVersion>65536</HDRGainMap:HDRGainMapVersion>
         <apdi:NativeFormat>1278226488</apdi:NativeFormat>
         <apdi:AuxiliaryImageType>urn:com:apple:photo:2020:aux:hdrgainmap</apdi:AuxiliaryImageType>
         <apdi:StoredFormat>1278226488</apdi:StoredFormat>
      </rdf:Description>
   </rdf:RDF>
</x:xmpmeta>


That alone means that nothing will read it as an image.  Checking further into the image, it doesn't look like there's a jpeg header after that.

Are you using PowerShell or CMD to extract the file?  PowerShell will corrupt binary data when redirected in this manner, so you'll want to use CMD.
Title: Re: How Could I extract MPF images (HDR gain Map) from iPhone's jpegs?
Post by: OverDrive on October 26, 2020, 11:53:42 AM
Quote from: StarGeek on October 26, 2020, 11:18:28 AM
I'm not too familiar with depth maps, but looking at your attached file, it has XMP code as it's header. 
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 6.0.0">
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description rdf:about=""
            xmlns:HDRGainMap="http://ns.apple.com/HDRGainMap/1.0/"
            xmlns:apdi="http://ns.apple.com/pixeldatainfo/1.0/">
         <HDRGainMap:HDRGainMapVersion>65536</HDRGainMap:HDRGainMapVersion>
         <apdi:NativeFormat>1278226488</apdi:NativeFormat>
         <apdi:AuxiliaryImageType>urn:com:apple:photo:2020:aux:hdrgainmap</apdi:AuxiliaryImageType>
         <apdi:StoredFormat>1278226488</apdi:StoredFormat>
      </rdf:Description>
   </rdf:RDF>
</x:xmpmeta>


That alone means that nothing will read it as an image.  Checking further into the image, it doesn't look like there's a jpeg header after that.

Are you using PowerShell or CMD to extract the file?  PowerShell will corrupt binary data when redirected in this manner, so you'll want to use CMD.

Thanks alot! I did using powershell, I am going to try it with CMD.
Title: Re: How Could I extract MPF images (HDR gain Map) from iPhone's jpegs?
Post by: StarGeek on October 26, 2020, 01:01:44 PM
It still might not work due to that XMP header, but there's a better chance if you can strip that.
Title: Re: How Could I extract MPF images (HDR gain Map) from iPhone's jpegs?
Post by: OverDrive on October 26, 2020, 10:07:02 PM
Quote from: StarGeek on October 26, 2020, 01:01:44 PM
It still might not work due to that XMP header, but there's a better chance if you can strip that.
It works! it was a problem of PowerShell. Thanks again.
Title: Re: How Could I extract MPF images (HDR gain Map) from iPhone's jpegs?
Post by: blue-j on November 04, 2020, 12:19:58 PM
May I ask how the XMP metadata was stripped in the end?  - J
Title: Re: How Could I extract MPF images (HDR gain Map) from iPhone's jpegs?
Post by: OverDrive on November 04, 2020, 08:17:11 PM
I used cmd and it worked.
Title: Re: How Could I extract MPF images (HDR gain Map) from iPhone's jpegs?
Post by: blue-j on November 06, 2020, 01:28:54 PM
I'm wondering if you might have a source image with such an asset embedded that you'd be willing to share?  Thanks in advance for your consideration!  - J