0

What is the difference between the following statements for setting a comment string

exiv2 -c tera img.JPG
exiv2 -M"set Exif.Photo.UserComment adagio" img.JPG

I can access them with

$ exiv2 -p c img.JPG
tera
$ exiv2 -p S img.JPG | grep adagio
         450 | 0x9286 UserComment                  | UNDEFINED |       14 |     38546 | ........adagio

What would be the proper way to add simple ASCII characters that won't longer than a dozen of characters.

phoxd
  • 1,546
  • 3
  • 12
  • 26

1 Answers1

1

The first command saves the text to the jpeg COM block (see Jpeg Syntax and structure). This is a jpeg only piece of metadata.

The second command saves the text to the EXIF UserComment tag. This is part of the EXIF standard of metadata.

The jpeg COM comment is a fairly fragile place to put metadata, as some programs will either not save it or overwrite it with their own text. The UserComment is less likely to be lost or overwritten by most programs.

StarGeek
  • 4,948
  • 2
  • 19
  • 30
  • As a side note, can you add own metatag with `exiv2 -M"add Exif.Photo.myTag value" img.JPG`? But it seems not possible, then what would be the difference between `add` and `set` when modifying metadata? – phoxd Feb 19 '20 at 05:38
  • You can't just make up your own tag like that. The various standards (EXIF, IPTC/IIM, XMP) are defined in very specific ways. While it is possible to add to them, you have to define where they go in order not to overwrite tags that already exist. I don't know if it's possible with exiv2, but [ExifTool](https://exiftool.org) has options to create your own tags, but it's very complex (see the [`example.config` file](https://exiftool.org/config.html)). As to the difference between set and add, I don't use exiv2, so I can't help there. – StarGeek Feb 19 '20 at 16:03