Copy MacOS Finder tags to IPTC

Started by jw3, September 30, 2022, 11:50:21 PM

Previous topic - Next topic

jw3

I'm trying to copy Finder color tags to IPTC on macOS Monterey. The tags show up in keywords in the Finder 'Get Info,' but do not show up as keywords in Apple Preview. I have tags installed. I've found another forum post about this, and have tried:

exiftool "-MDItemUserTags<keywords" -r /dir

but I am getting various errors, including "Warning: No writable tags set" and "Warning: [minor] Bad format (16) for MakerNotes entry 13" & entry 14.

I've also tried the other recommended command, exiftool "-MDItemUserTags<subject" -r /dir , and am getting the same error.

How would I get this to work? Also, I'm mainly attempting this on JPGs, but I also have DNG files. How would I write this IPTC info to the DNG file as well?

Thanks for any assistance.

wywh

#1
I do not quite understand what you are trying to do. It is possible to copy either of these macOS 12 Monterey Finder color tags to 'IPTC:Keywords' and 'XMP-dc:Subject' in images...

exiftool -a -G1 -s -api RequestAll=2 image.jpg
[MacOS]         MDItemUserTags                  : Red, Blue
[MacOS]         XAttrMDItemUserTags             : Red.6, Blue.4

exiftool -m -P -overwrite_original_in_place '-IPTC:Keywords<MacOS:MDItemUserTags' '-XMP-dc:Subject<MacOS:MDItemUserTags' image.jpg

[IPTC]          Keywords                        : Red, Blue
[XMP-dc]        Subject                         : Red, Blue

...but are you really talking about these movie tags that Final Cut Pro 10.6.4 can optionally create from Finder tags when importing and exporting (Keys seems to be best at least on Apple's devices):

[Keys]          Keywords                        : 16.9.2022,blue,import_folder
[ItemList]      Keyword                         : 16.9.2022,blue,import_folder
[UserData]      Keywords                        : 16.9.2022,blue,import_folder

Movie Title, Description, Author and Keywords:

https://exiftool.org/forum/index.php?topic=12176

- Matti


StarGeek

Clarification:  Are you trying to copy to the MDItemUserTags or from them?

Your title states you want to copy from MDItemUserTags into the IPTC:Keywords, but your commands show you're trying the opposite, copying from IPTC:Keywords/XMP:Subject into the MDItemUserTags.

The target of the copy is the direction of the Greater Than/Less Than symbols </>.  If you use <, that means you're copying from the tag on the right into the tag on the left.  Using > means you're copying from the tag on the left into the tag on the right.
* 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).

jw3

Thanks for your replies. I had the syntax reversed. I have to admit I am confused by the syntax and various commands of EXIFTool, and am not especially familiar with the various syntax differences between IPTC and XMP.

What I'm trying to do is copy MacOS Finder tags to both JPG and DNG (raw) iPhone photos. Running exiftool "-MDItemUserTags>keywords" -r /dir works for the JPG files, but not the DNG file's embedded IPTC. It skips the DNG files. I would prefer to copy the Finder tags to IPTC keywords rather than XMP subject. How can I do this? If it is not possible to write into the DNG IPTC, how would I create an XMP sidecar file for the DNG files, containing these Finder color tags plus all other normal embedded IPTC/EXIF/XMP data from the DNGs?

By the way, I have tested running exiftool "-MDItemUserTags>subject" -r /dir on the DNG files, and it does not work, giving dquote> error. There seems to be something wrong with this syntax or running it on DNG files.

Phil Harvey

Quote from: jw3 on October 02, 2022, 07:01:51 PMRunning exiftool "-MDItemUserTags>keywords" -r /dir works for the JPG files, but not the DNG file's embedded IPTC.

This should absolutely work for DNG files too, provided they have MDItemUserTags set.  Why do you say this doesn't work?  I hope you are using ExifTool to read back the Keywords afterwards, because otherwise we are dealing with inadequacies in some other software.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

wywh

#5
Quote from: jw3 on October 02, 2022, 07:01:51 PMexiftool "-MDItemUserTags>subject" -r

Works for my DJI P3P .dng with macOS 12 Finder color tags:

exiftool "-MDItemUserTags>subject" "-MDItemUserTags>keywords" -r image.dng
    1 image files updated

exiftool -a -G1 -s -subject -keywords image.dng                           
[XMP-dc]        Subject                         : Green, Purple
[IPTC]          Keywords                        : Green, Purple

Works also for iPhone 13 .dng although for some reason XMP-dc:Subject is listed three times:

exiftool "-MDItemUserTags>subject" "-MDItemUserTags>keywords" -r IMG_9676.DNG         
Warning: [Minor] Not decoding some large array(s). Ignore minor errors to decode - IMG_9676.DNG
    1 image files updated

exiftool -a -G1:7 -s -subject -keywords IMG_9676.DNG
[XMP-dc:ID-subject] Subject                     : Red, Blue
[XMP-dc:ID-subject] Subject                     : Red, Blue
[XMP-dc:ID-subject] Subject                     : Red, Blue
[IPTC:ID-25]    Keywords                        : Red, Blue

or:

exiftool -a -G1:5 -s -subject -keywords IMG_9676.DNG
[XMP-dc:TIFF-IFD0-SubIFD1-XMP] Subject          : Red, Blue
[XMP-dc:TIFF-IFD0-SubIFD2-XMP] Subject          : Red, Blue
[XMP-dc:TIFF-IFD0-XMP] Subject                  : Red, Blue
[IPTC:TIFF-IFD0-IPTC] Keywords                  : Red, Blue

- Matti

Phil Harvey

Hi Matti,

Quote from: wywh on October 03, 2022, 04:19:40 AMWorks also for iPhone 13 .dng although for some reason XMP-dc:Subject is listed three times:

Apple is doing something very weird here.  You can add the -G5 option to see where this other XMP is stored.  Also try this on one of the files:

exiftool -validate -warning -a FILE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

wywh

Quote from: Phil Harvey on October 03, 2022, 06:57:06 AM-G5 option to see where this other XMP is stored

exiftool -validate -warning -a IMG_9676.DNG                          
Validate                        : 6 Warnings (all minor)
Warning                         : [minor] Non-standard SubIFD tag 0xcd2d ProfileGainTableMap
Warning                         : [minor] Non-standard XMP at TIFF-IFD0-SubIFD1-XMP
Warning                         : [minor] Non-standard SubIFD1 tag 0xcd2e SemanticName
Warning                         : [minor] Non-standard XMP at TIFF-IFD0-SubIFD2-XMP
Warning                         : [minor] Non-standard SubIFD2 tag 0xcd2e SemanticName
Warning                         : [Minor] Not decoding some large array(s). Ignore minor errors to decode

exiftool -a -G5 -s -subject -keywords IMG_9676.DNG                          
[TIFF-IFD0-SubIFD1-XMP] Subject                 : Red, Blue
[TIFF-IFD0-SubIFD2-XMP] Subject                 : Red, Blue
[TIFF-IFD0-XMP] Subject                         : Red, Blue
[TIFF-IFD0-IPTC] Keywords                       : Red, Blue

Sample file at:

https://www.dropbox.com/s/vz86vb5ycwb9123/IMG_9676.DNG.zip?dl=0

- Matti

Phil Harvey

There you go.  There is XMP in 3 different locations.

By default, ExifTool updates all XMP that it finds.  Maybe I should add an option to only update XMP in the standard location.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jw3

Running exiftool -validate -warning -a IMG_7223.DNG on an iPhone 14 Pro ProRAW DNG file gives the following errors:

Validate                        : 6 Warnings (all minor)
Warning                        : [minor] Non-standard SubIFD tag 0xcd2d ProfileGainTableMap
Warning                        : [minor] Non-standard XMP at TIFF-IFD0-SubIFD1-XMP
Warning                        : [minor] Non-standard SubIFD1 tag 0xcd2e SemanticName
Warning                        : [minor] Bad format (16) for MakerNotes entry 14
Warning                        : [minor] Bad format (16) for MakerNotes entry 22
Warning                        : [Minor] Not decoding some large array(s). Ignore minor errors to decode

The file is tagged in the Finder, and when I run EXIFtool, I just get this exiftool "-MDItemUserTags>subject" IMG_7223.DNG
dquote>


Just this dquote> message. It won't actually add the tags to the subject. If I run exiftool -a -G5 -s -subject -keywords IMG_7223.DNG, I get:

Warning: [minor] Bad format (16) for MakerNotes entry 14 - IMG_7223.DNG
Warning: [minor] Bad format (16) for MakerNotes entry 22 - IMG_7223.DNG
Warning: [Minor] Not decoding some large array(s). Ignore minor errors to decode - IMG_7223.DNG

StarGeek

Quote from: jw3 on October 03, 2022, 03:41:45 PMJust this dquote> message. It won't actually add the tags to the subject

Double check your quotes.  Make sure they're not fancy/smart curly type quotes.  See How to come out of dquote prompt in Terminal
* 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).

jw3

It was a quotation and copy/paste issue. It still doesn't work though. The file has proper Finder labels.

exiftool "-MDItemUserTags>subject" IMG_7209.DNG
Warning: [minor] Bad format (16) for MakerNotes entry 14 - IMG_7209.DNG
Warning: No writable tags set from IMG_7209.DNG
    0 image files updated
    1 image files unchanged

Phil Harvey

Check to be sure the MDItemUserTags still exist in the file:

exiftool -mditemusertags FILE

The MacOS MDItem tags are very quirky.  The system updates them at its leisure, whenever the MacOS mdworker daemon decides it wants to run on the file.

Also, running some tests with my MacOS 10.14 system here, the behaviour of the MDItem tags is not intuitive.  The tags stay with the "_original" copy of the file if it didn't already exist.  Otherwise, they get transferred to the edited file.  Using either the -overwrite_original or -overwrite_original_in_place option ensures that the edited file gets the MDItem tags.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jw3

I'm using MacOS 12.6. The Finder shows tags on the file, and the tags are viewable in the Finder "Get Info" and when I run a Spotlight search on the folder, so presumably it has been properly indexed. Running what you asked,

exiftool -mditemusertags IMG_7209.DNG
Warning: [minor] Bad format (16) for MakerNotes entry 14 - IMG_7209.DNG


I have not even got to EXIFTool creating original copies with the DNG file yet. On the JPGs I have successfully processed, the Finder tags have NOT automatically transferred to the edited files and have stayed with the _original files only. I have not tried -overwrite_original yet on the JPGs.

Phil Harvey

ExifTool doesn't see any MDItemUserTags, so that is the problem.

Try looking at all of the MacOS tags to see if this sheds a light on the situation:

exiftool -macos:all FILE

ExifTool uses the MacOS "mdls" utility to obtain this information.  So you can also try this:

mdls FILE

Which should give the same result, with the exception of formatting differences.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).