How Could I extract MPF images (HDR gain Map) from iPhone's jpegs?

Started by OverDrive, October 26, 2020, 10:37:00 AM

Previous topic - Next topic

OverDrive

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

OverDrive

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"

StarGeek

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.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

OverDrive

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.

StarGeek

It still might not work due to that XMP header, but there's a better chance if you can strip that.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

OverDrive

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.

blue-j

May I ask how the XMP metadata was stripped in the end?  - J


blue-j

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