ExifTool Forum

General => Metadata => Topic started by: eeeps on July 08, 2021, 05:22:43 PM

Title: XMP (and other?) metadata that maps to EXIF
Post by: eeeps on July 08, 2021, 05:22:43 PM
The HTML spec just landed a change, telling browsers to take EXIF resolution information into account when assigning images' intrinsic size.

https://github.com/whatwg/html/pull/5574

The spec currently tells browsers to look strictly at *binary* EXIF information; we are trying to figure out how to test this.

I know that XMP also defines fields which map to EXIF fields. I have two questions:

1. Is there a way to create an image with XMP fields which map to EXIF's `ResolutionUnit`, `XResolution`, `YResolution`, `PixelXDimension`, and `PixelYDimension`, without having the corresponding binary EXIF data, also?
2. Are there other metadata formats which contain fields that map to these EXIF fields?

Thank you!
Title: Re: XMP (and other?) metadata that maps to EXIF
Post by: StarGeek on July 08, 2021, 08:05:24 PM
Quote from: eeeps on July 08, 2021, 05:22:43 PM
1. Is there a way to create an image with XMP fields which map to EXIF's `ResolutionUnit`, `XResolution`, `YResolution`, `PixelXDimension`, and `PixelYDimension`, without having the corresponding binary EXIF data, also?

You can directly set the XMP-exif (https://exiftool.org/TagNames/XMP.html#exif), XMP-exifEX (https://exiftool.org/TagNames/XMP.html#exifEX) and XMP-tiff (https://exiftool.org/TagNames/XMP.html#tiff) tags without setting the EXIF tags at all. None of those tags are marked to avoid, so all you have to do is choose the tag name from those sections of the XMP tags page and prefix XMP:, e.g. -XMP:Orientation=Horizontal -XMP:ImageHeight=1200 -XMP:ImageWidth=1600.

Or if the EXIF tags are already set, use the exif2XMP.args file (https://github.com/exiftool/exiftool/blob/master/arg_files/exif2xmp.args) to copy all the EXIF data to the corrisponding XMP locations and remove the EXIF block
exiftool -EXIF:All= -tagsFromFile @ -@ exif2xmp.args /path/to/files/

Quote2. Are there other metadata formats which contain fields that map to these EXIF fields?

There are technically a few IPTC tags that correspond with EXIF tags, but not many.  Mostly the time related tags.  See the exif2iptc.args file (https://github.com/exiftool/exiftool/blob/master/arg_files/exif2iptc.args) for details.
Title: Re: XMP (and other?) metadata that maps to EXIF
Post by: eeeps on July 13, 2021, 07:13:47 PM
This is exactly the information I needed, and works perfectly. Thank you!!!

(Extra credit question: is there any way to change the placement of the eXIf block when writing EXIF to PNGs? By default, it goes after IDAT using 12.16; per https://github.com/w3c/PNG-spec/issues/28 it would be great to get it in front.)
Title: Re: XMP (and other?) metadata that maps to EXIF
Post by: Phil Harvey on July 13, 2021, 08:37:34 PM
July 9, 2021 - Version 12.29
  - Changed PNG writer to add EXIF before IDAT

- Phil
Title: Re: XMP (and other?) metadata that maps to EXIF
Post by: eeeps on July 16, 2021, 11:20:40 AM
Amazing! Thank you.