Google takeout JSON - PeopleName tag to Description or User Comment tag

Started by martonpapai, May 13, 2023, 12:48:26 AM

Previous topic - Next topic

martonpapai

hi Everyone, hope I'm posting this to the right place,

I downloaded all my Google photos via takeout, and now trying to write all the names I tagged in Google photos into the original files.

After several hours of googling, here's where I am:

- created a config file and added a new tag:

  'Image::ExifTool::Exif::Main' => {
        # Example 1.  EXIF:NewEXIFTag
        0xd000 => {
            Name => 'PeopleName',
            Format => 'string',
            Writable => 'string'

and using this command to process all images in a folder:

exiftool -ext json -d %s -tagsfromfile -a '%d/%F.json' -execute "-PeopleName<Description" -common_args -overwrite_original_in_place .


what am I doing wrong?

thank you and sorry if I'm posting this to the wrong place

StarGeek

Quote from: martonpapai on May 13, 2023, 12:48:26 AMI downloaded all my Google photos via takeout, and now trying to write all the names I tagged in Google photos into the original files.

Rather than make your own tag which no program other than exiftool can read, I'd suggest writing to the XMP:PersonInImage tag, as this is the standard place to write it and part of the IPTC Photo Metadata Standard

Quote- created a config file and added a new tag:

Was this added to a .ExifTool_config file or is it a separate config file?  If the latter, then the -Config option needs to be used.

Quoteand using this command to process all images in a folder:

exiftool -ext json -d %s -tagsfromfile -a '%d/%F.json' -execute "-PeopleName<Description" -common_args -overwrite_original_in_place .

The -execute option is almost certainly not needed, as most of the tag names in Google json files don't match anything that can be in an image file.  Description and Title would be the only things copied.  Also, you are only processing the json files -ext json and exiftool cannot edit json files.  You probably want --ext json to exclude them.  And you put the -a (-duplicates) option, which doesn't do anything when copying data, in between the -TagsFromFile and the file path to find the json files.

Testing your config here seems to work
C:\>exiftool -G1 -a -s -Description y:\!temp\Test4.jpg
[XMP-dc]        Description                     : Jack Sparrow, Blackbeard

C:\>type test.config
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Exif::Main' => {
        # Example 1.  EXIF:NewEXIFTag
        0xd000 => {
            Name => 'PeopleName',
            Format => 'string',
            Writable => 'string'
        },
    },
);
#------------------------------------------------------------------------------
1;  #end


C:\>exiftool -config test.config -P -overwrite_original "-PeopleName<Description" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -config test.config -G1 -a -s -exif:all y:\!temp\Test4.jpg
[IFD0]          XResolution                     : 72
[IFD0]          YResolution                     : 72
[IFD0]          ResolutionUnit                  : inches
[IFD0]          YCbCrPositioning                : Centered
[ExifIFD]       ExifVersion                     : 0232
[ExifIFD]       ComponentsConfiguration         : Y, Cb, Cr, -
[ExifIFD]       FlashpixVersion                 : 0100
[ExifIFD]       ColorSpace                      : Uncalibrated
[ExifIFD]       PeopleName                      : Jack Sparrow, Blackbeard

But, as I said, no program other than exiftool will show this info and without the config file, you would only see it with the -u (-unknown) option
C:\>exiftool -G1 -a -s -exif:all y:\!temp\Test4.jpg
[IFD0]          XResolution                     : 72
[IFD0]          YResolution                     : 72
[IFD0]          ResolutionUnit                  : inches
[IFD0]          YCbCrPositioning                : Centered
[ExifIFD]       ExifVersion                     : 0232
[ExifIFD]       ComponentsConfiguration         : Y, Cb, Cr, -
[ExifIFD]       FlashpixVersion                 : 0100
[ExifIFD]       ColorSpace                      : Uncalibrated

C:\>exiftool -G1 -a -s -u -exif:all y:\!temp\Test4.jpg
[IFD0]          XResolution                     : 72
[IFD0]          YResolution                     : 72
[IFD0]          ResolutionUnit                  : inches
[IFD0]          YCbCrPositioning                : Centered
[ExifIFD]       ExifVersion                     : 0232
[ExifIFD]       ComponentsConfiguration         : Y, Cb, Cr, -
[ExifIFD]       FlashpixVersion                 : 0100
[ExifIFD]       ColorSpace                      : Uncalibrated
[ExifIFD]       Exif_0xd000                     : Jack Sparrow, Blackbeard

Assuming that the people names in the description are separated by (comma)(space), I would suggest trying.

exiftool --ext json -tagsfromfile '%d/%F.json' -sep ', ' '-PersonInImage<Description' -overwrite_original_in_place .

I'm assuming you're using a Mac and want to keep the MDItem*/XAttr* file data.  If not, you should use the -overwrite_original option instead of the -overwrite_original_in_place option, as the latter will double the processing time and has no advantage when on a Windows or Linux system.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).