ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Toms on January 18, 2023, 09:35:30 AM

Title: Copying IPTC Supplemental Categories to Keywords
Post by: Toms on January 18, 2023, 09:35:30 AM
Hi!

How do I copy everything from IPTC field "SupplementalCategories", and append it to the IPTC "Keywords" field?

For example, i have Supplemental Categories:
  category_1
  category_2
and Keywords:
  keyword_1
  keyword_2
  keyword_3
and I'd like the new Keywords look like this (order is not important):
  keyword_1
  keyword_2
  keyword_3
  category_1
  category_2

I've tried this:
exiftool "-iptc:Keywords+<iptc:SupplementalCategories" C:\temp
but after this the first keywords are replaced with categories:
  category_1
  category_2
  keyword_3

Thank you in advance!
Title: Re: Copying IPTC Supplemental Categories to Keywords
Post by: Phil Harvey on January 18, 2023, 09:49:15 AM
> exiftool a.jpg -iptc:supplementalcategories -iptc:keywords
Supplemental Categories         : category_1, category_2
Keywords                        : keyword_1, keyword_2, keyword_3
> exiftool a.jpg "-iptc:Keywords+<iptc:SupplementalCategories"
    1 image files updated
> exiftool a.jpg -iptc:supplementalcategories -iptc:keywords
Supplemental Categories         : category_1, category_2
Keywords                        : keyword_1, keyword_2, keyword_3, category_1, category_2

- Phil
Title: Re: Copying IPTC Supplemental Categories to Keywords
Post by: Toms on January 19, 2023, 03:53:55 AM
Indeed... I tested keywords with an old app ThumbsPlus, which for some reason was not able to display all the keywords. Probably, it is just too old  :-\
Thank you!
Title: Re: Copying IPTC Supplemental Categories to Keywords
Post by: StarGeek on January 19, 2023, 10:39:18 AM
You might check to make sure that the keywords have been separated properly.  The above command will copy them correctly, but something else might not have.

Add the -sep option (https://exiftool.org/exiftool_pod.html#sep-STR--separator) to see where the keywords are actually separated.

For example, with -sep ## you would get this
C:\>exiftool -G1 -a -s -sep ## -keywords y:\!temp\Test4.jpg
[IPTC]          Keywords                        : keyword_1##keyword_2##keyword_3##category_1##category_2

If instead you get this
C:\>exiftool -G1 -a -s -sep ## -keywords y:\!temp\Test4.jpg
[IPTC]          Keywords                        : keyword_1, keyword_2, keyword_3, category_1, category_2
then they aren't separated properly.  See FAQ #17 (https://exiftool.org/faq.html#Q17) for command to fix in this case.

Also, if the individual keywords are long, over 64 characters, then you're running into the IPTC character limit.  The -m (-ignoreMinorErrors) option (https://exiftool.org/exiftool_pod.html#m--ignoreMinorErrors) is needed to write keywords longer than that.