ExifTool Forum

General => Metadata => Topic started by: cyberspectre on April 01, 2020, 07:01:45 PM

Title: Rename file using XMP-exif:Headline
Post by: cyberspectre on April 01, 2020, 07:01:45 PM
Hi everyone. Help out a newbie?

I'm trying to use exiftool to rename images using their metadata. In particular, the field I want to use is the XMP-exif:Headline field, which is present in the PNGs I'm working with. Here is the exiftool read output of a file.


  ExifToolVersion = 11.92
  FileName = test1.png
  Directory = .
  FileSize = 9656800
  FileModifyDate = 1583805214
  FileAccessDate = 1585771042
  FileInodeChangeDate = 1585771067
  FilePermissions = 33261
  FileType = PNG
  FileTypeExtension = PNG
  MIMEType = image/png
PNG IHDR (13 bytes):
  + [BinaryData directory, 13 bytes]
  | ImageWidth = 3082
  | ImageHeight = 2413
  | BitDepth = 8
  | ColorType = 6
  | Compression = 0
  | Filter = 0
  | Interlace = 0
PNG iTXt (1398 bytes):
  + [XMP directory, 1376 bytes]
  | XMPToolkit = Adobe XMP Core 5.6-c145 79.163499, 2018/08/13-16:40:22
  | Marked = False
  | OriginalDocumentID = uuid:408ED2AC155FE611ABE89B4880765333
  | DocumentID = xmp.did:E6130E6A627111EA946BFBF022B636C8
  | InstanceID = xmp.iid:E6130E69627111EA946BFBF022B636C8
  | CreatorTool = Adobe Photoshop CC 2019 (Windows)
  | [adding XMP-exif:Headline]
  | Headline = Example Product Name
  | [adding XMP-exif:Caption]
  | Caption = To learn more, visit www.company.com/example-product
  | [adding XMP-exif:Keywords]
  | Keywords = dental, dentist, toothpaste, fluoride, toothbrush
  | DerivedFromInstanceID = xmp.iid:ebb22efa-a47e-f14c-8ccc-e6da4a518948
  | DerivedFromDocumentID = adobe:docid:photoshop:a2331c54-0dcf-f84e-a11f-416c7c35fe98
PNG tEXt (25 bytes):
  Software = Adobe ImageReady
PNG IDAT (1 chunk, total 9655296 bytes)
PNG IEND (end of image)


The command I'm trying to use is as follows.

./exiftool "-FileName<${XMP-exif:Headline}" test1.png

The desired result would be that "test1.png" is renamed to "Example Product Name.png". Instead, I get the following error.


Warning: No writable tags set from test1.png
    0 image files updated
    1 image files unchanged


What am I doing wrong? Thanks.
Title: Re: Rename file using XMP-exif:Headline
Post by: StarGeek on April 01, 2020, 07:17:40 PM
That's very strange.  Exiftool doesn't have a definition for an XMP-exif:Headline tag (nor the Caption or Keywords).  See the XMP tag page (https://exiftool.org/TagNames/XMP.html).  It's even odder because the root names used, Headline/Caption/Keywords don't even exist in the EXIF block, which is where the XMP-Exif tags are copied from.

Valid Headline locations are XMP-iptcExt:Headline (avoided) and XMP-photoshop:Headline (preferred by most specs).  IMO, it's best practice to avoid specifying specific XMP locations unless you really have a special need.  It's better to just use XMP:Headline or even just Headline.