Extract all xmp binary data if the data is spread over multiple sections

Started by spitfire_ch, January 07, 2024, 03:11:08 PM

Previous topic - Next topic

spitfire_ch

First of all, thanks for creating and supporting this awesome tool which I have been using for many years, now!

In my current project, I am trying to read all xmp data from the original file and then apply it to the target file. For that, I use the binary format:

  • exiftool -xmp -b source.jpg
  • save the output in a file temp.xmp
  • exiftool -tagsfromfile temp.xmp -xmp:all target.jpg

That works well for most images. But there are cases with two xmp sections, e.g. if a picture is shot with an iPhone or a Xiaomi phone in portrait mode, the phone itself adds the first section - before the EXIF data. If I rate or label the picture in Adobe Bridge, another section is added - after the EXIF data.

The above commands only extract the first xmp section. But I am mostly interested in the second xmp section (which contains the rating and label). How do I do that properly?

Thanks a lot for your help!

First XMP section
XMP-MiCamera    XMPMeta <?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<depthmap version="2"
          focuspoint="2492,947"
          blurlevel="9"
          depthsize="0,0"
          shinethreshold="5"
          shinelevel="10"
          rawlength="2444466"
          depthlength="5277988"
          mimovie="false"
          depthOrientation="90"
          vendor="1"
          portraitLightingVersion="2"
          cameraPreferredMode="0"/>

Second XMP section
XMP-x  XMPToolkit      Adobe XMP Core 5.6-c140 79.160451, 2017/05/06-01:08:21
XMP-xmp Rating  4
XMP-xmp MetadataDate    2023:12:31 21:23:17+01:00
XMP-xmp Label  Approved
XMP-xmpMM      DocumentID      03E58BB3440ADD3CEA93A2B9CC0D0DD5
XMP-xmpMM      OriginalDocumentID      03E58BB3440ADD3CEA93A2B9CC0D0DD5
XMP-xmpMM      InstanceID      xmp.iid:86466129-3ddd-9c42-bbca-5418a8f2c02b
XMP-xmpMM      HistoryAction  saved, saved
XMP-xmpMM      HistoryInstanceID      xmp.iid:4a902e14-6f6b-ce40-9b75-00a9b7c755ac, xmp.iid:86466129-3ddd-9c42-bbca-5418a8f2c02b
XMP-xmpMM      HistoryWhen    2023:12:29 17:39:50+01:00, 2023:12:31 21:23:17+01:00
XMP-xmpMM      HistorySoftwareAgent    Adobe Photoshop Camera Raw 10.3, Adobe Photoshop Camera Raw 10.3 (Windows)
XMP-xmpMM      HistoryChanged  /metadata, /metadata
XMP-dc  Format  image/jpeg
XMP-exifEX      PhotographicSensitivity 50


exiftool -XMP -b source.jpg
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.1.0-jc003">
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description rdf:about=""
        xmlns:MiCamera="http://ns.xiaomi.com/photos/1.0/camera/"
      MiCamera:XMPMeta="&lt;?xml version='1.0' encoding='UTF-8' standalone='yes' ?&gt;&lt;depthmap version=&quot;2&quot; focuspoint=&quot;2492,947&quot; blurlevel=&quot;9&quot; depthsize=&quot;0,0&quot; shinethreshold=&quot;5&quot; shinelevel=&quot;10&quot; rawlength=&quot;2444466&quot; depthlength=&quot;5277988&quot; mimovie=&quot;false&quot; depthOrientation=&quot;90&quot; vendor=&quot;1&quot; portraitLightingVersion=&quot;2&quot; cameraPreferredMode=&quot;0&quot; /&gt;"/>
  </rdf:RDF>
</x:xmpmeta>

exiftool -XMP:all -b source.jpg
-> extracts the label but not the rating, and cannot be applied to the target image

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><depthmap version="2" focuspoint="2492,947" blurlevel="9" depthsize="0,0" shinethreshold="5" shinelevel="10" rawlength="2444466" depthlength="5277988" mimovie="false" depthOrientation="90" vendor="1" portraitLightingVersion="2" cameraPreferredMode="0" />Adobe XMP Core 5.6-c140 79.160451, 2017/05/06-01:08:21        42023:12:31 21:23:17+01:00Approved03E58BB3440ADD3CEA93A2B9CC0D0DD503E58BB3440ADD3CEA93A2B9CC0D0DD5xmp.iid:86466129-3ddd-9c42-bbca-5418a8f2c02bimage/jpeg50saved
savedxmp.iid:4a902e14-6f6b-ce40-9b75-00a9b7c755ac
xmp.iid:86466129-3ddd-9c42-bbca-5418a8f2c02b2023:12:29 17:39:50+01:00
2023:12:31 21:23:17+01:00Adobe Photoshop Camera Raw 10.3
Adobe Photoshop Camera Raw 10.3 (Windows)/metadata
/metadata

exiftool -s -G1 -t --composite source.jpg
ExifTool        ExifToolVersion 12.72
System  FileName        IMG_20231203_160051.jpg
System  Directory      .
System  FileSize        9.2 MB
System  FileModifyDate  2023:12:31 21:23:17+01:00
System  FileAccessDate  2024:01:06 21:59:30+01:00
System  FileCreateDate  2023:12:29 18:26:07+01:00
System  FilePermissions -rw-rw-rw-
File    FileType        JPEG
File    FileTypeExtension      jpg
File    MIMEType        image/jpeg
File    ExifByteOrder  Big-endian (Motorola, MM)
File    CurrentIPTCDigest      821c238c298e5278742327fd06039b14
File    ImageWidth      2052
File    ImageHeight    3648
File    EncodingProcess Baseline DCT, Huffman coding
File    BitsPerSample  8
File    ColorComponents 3
File    YCbCrSubSampling        YCbCr4:2:0 (2 2)
IFD0    Make    Xiaomi
IFD0    Orientation    Horizontal (normal)
IFD0    ModifyDate      2023:12:03 16:00:51
IFD0    YResolution    72
IFD0    XResolution    72
IFD0    Model  2211133G
IFD0    YCbCrPositioning        Centered
IFD0    ResolutionUnit  inches
IFD0    XiaomiModel    Xiaomi 13
GPS    GPSLatitudeRef  North
GPS    GPSLatitude    47 deg 23' 49.84"
GPS    GPSLongitudeRef East
GPS    GPSLongitude    8 deg 32' 43.77"
GPS    GPSAltitudeRef  Above Sea Level
GPS    GPSAltitude    537.3 m
GPS    GPSTimeStamp    15:00:38
GPS    GPSSpeedRef    km/h
GPS    GPSSpeed        0
GPS    GPSProcessingMethod    network
GPS    GPSDateStamp    2023:12:03
XMP-MiCamera    XMPMeta <?xml version='1.0' encoding='UTF-8' standalone='yes' ?><depthmap version="2" focuspoint="2492,947" blurlevel="9" depthsize="0,0" shinethreshold="5" shinelevel="10" rawlength="2444466" depthlength="5277988" mimovie="false" depthOrientation="90" vendor="1" portraitLightingVersion="2" cameraPreferredMode="0" />
ExifIFD ExifVersion    0220
ExifIFD ApertureValue  2.0
ExifIFD SceneType      Directly photographed
ExifIFD ExposureCompensation    0
ExifIFD ExposureProgram Program AE
ExifIFD ColorSpace      Uncalibrated
ExifIFD MaxApertureValue        2.0
ExifIFD ExifImageHeight 3648
ExifIFD BrightnessValue 6.17
ExifIFD DateTimeOriginal        2023:12:03 16:00:51
ExifIFD FlashpixVersion 0100
ExifIFD SubSecTimeOriginal      093
ExifIFD WhiteBalance    Auto
ExifIFD ExposureMode    Auto
ExifIFD ExposureTime    1/271
ExifIFD OffsetTime      +01:00
ExifIFD Flash  Off, Did not fire
ExifIFD SubSecTime      093
ExifIFD FNumber 2.0
ExifIFD ExifImageWidth  2052
ExifIFD ISO    50
ExifIFD ComponentsConfiguration Y, Cb, Cr, -
ExifIFD FocalLengthIn35mmFormat 75 mm
ExifIFD SubSecTimeDigitized    093
ExifIFD CreateDate      2023:12:03 16:00:51
ExifIFD ShutterSpeedValue      1/271
ExifIFD MeteringMode    Center-weighted average
ExifIFD FocalLength    7.1 mm
ExifIFD OffsetTimeOriginal      +01:00
ExifIFD SceneCaptureType        Standard
ExifIFD LightSource    D65
ExifIFD SensingMethod  Not defined
JSON    AIScene 0
JSON    Hdr    auto
JSON    OpMode  36864
JSON    FilterId        66048
JSON    Mirror  false
JSON    SensorType      rear
JSON    SmallPicture    false
JSON    ZoomMultiple    3
InteropIFD      InteropIndex    R98 - DCF basic file (sRGB)
InteropIFD      InteropVersion  0100
IFD1    Compression    JPEG (old-style)
IFD1    ThumbnailOffset 12594
IFD1    ThumbnailLength 8794
XMP-x  XMPToolkit      Adobe XMP Core 5.6-c140 79.160451, 2017/05/06-01:08:21
XMP-xmp Rating  4
XMP-xmp MetadataDate    2023:12:31 21:23:17+01:00
XMP-xmp Label  Approved
XMP-xmpMM      DocumentID      03E58BB3440ADD3CEA93A2B9CC0D0DD5
XMP-xmpMM      OriginalDocumentID      03E58BB3440ADD3CEA93A2B9CC0D0DD5
XMP-xmpMM      InstanceID      xmp.iid:86466129-3ddd-9c42-bbca-5418a8f2c02b
XMP-xmpMM      HistoryAction  saved, saved
XMP-xmpMM      HistoryInstanceID      xmp.iid:4a902e14-6f6b-ce40-9b75-00a9b7c755ac, xmp.iid:86466129-3ddd-9c42-bbca-5418a8f2c02b
XMP-xmpMM      HistoryWhen    2023:12:29 17:39:50+01:00, 2023:12:31 21:23:17+01:00
XMP-xmpMM      HistorySoftwareAgent    Adobe Photoshop Camera Raw 10.3, Adobe Photoshop Camera Raw 10.3 (Windows)
XMP-xmpMM      HistoryChanged  /metadata, /metadata
XMP-dc  Format  image/jpeg
XMP-exifEX      PhotographicSensitivity 50
IPTC    CodedCharacterSet      UTF8
IPTC    ApplicationRecordVersion        4
IPTC    DateCreated    2023:12:03
IPTC    TimeCreated    16:00:51
Photoshop      IPTCDigest      821c238c298e5278742327fd06039b14
ICC-header      ProfileCMMType
ICC-header      ProfileVersion  4.0.0
ICC-header      ProfileClass    Display Device Profile
ICC-header      ColorSpaceData  RGB
ICC-header      ProfileConnectionSpace  XYZ
ICC-header      ProfileDateTime 2022:08:08 08:08:08
ICC-header      ProfileFileSignature    acsp
ICC-header      PrimaryPlatform Unknown ()
ICC-header      CMMFlags        Not Embedded, Independent
ICC-header      DeviceManufacturer      Unknown (XM  )
ICC-header      DeviceModel
ICC-header      DeviceAttributes        Reflective, Glossy, Positive, Color
ICC-header      RenderingIntent Perceptual
ICC-header      ConnectionSpaceIlluminant      0.9642 1 0.82491
ICC-header      ProfileCreator  Apple Computer Inc.
ICC-header      ProfileID      0
ICC_Profile    ProfileDescription      sRGB EOTF with DCI-P3 Color Gamut
ICC_Profile    ProfileCopyright        Copyright Xiaomi Communications Co., Ltd. 2022
ICC_Profile    MediaWhitePoint 0.96419 1 0.82489
ICC_Profile    RedMatrixColumn 0.51512 0.2412 -0.00105
ICC_Profile    GreenMatrixColumn      0.29198 0.69225 0.04189
ICC_Profile    BlueMatrixColumn        0.1571 0.06657 0.78407
ICC_Profile    RedTRC  (Binary data 32 bytes, use -b option to extract)
ICC_Profile    ChromaticAdaptation    1.04788 0.02292 -0.0502 0.02959 0.99048 -0.01706 -0.00923 0.01508 0.75168
ICC_Profile    BlueTRC (Binary data 32 bytes, use -b option to extract)
ICC_Profile    GreenTRC        (Binary data 32 bytes, use -b option to extract)

StarGeek

"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

spitfire_ch

As a matter of fact, it does, -a does the trick! Thank you so much!!