• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Importing PNG files with metadata doesn't parse keywords correctly

Explorer ,
Oct 11, 2024 Oct 11, 2024

Copy link to clipboard

Copied

I am trying to import PNG files that already have intact metadata fields. I have been using the ExifTool (a standard tool for reading, writing, and editing EXIF metadata) to inject all the metadata I need into the PNG files, and most fields import correctly into Lightroom such as Title, Caption, and Copyright. The only field I'm struggling with is the keyword tags.

 

If I have keywords such as "tag1, tag2, tag3" in the PNG metadata (located in the Subject, Keywords, or Weighted Flat Subject fields), when this is imported into Lightroom it gets assigned as a single keyword called "tag1, tag2, tag3" instead of separating them as individual keywords "tag1," "tag2," "tag3," (even though commas in keyword names are supposedly disallowed in Lightroom, since they are used to delimit keyword lists). Here is how it looks in the keyword list after import:

Screenshot 2024-10-11 103336.png

The same happens if I delimit the keywords with semicolons in the PNG metadata, they are imported as a single keyword "tag1; tag2; tag3". If I edit the keywords in the keywording panel, such as adding a keyword, it will then split out all the keywords into individual keywords, leaving behind an unassigned "tag1, tag2, tag3" keyword in the keyword list.

 

If I wanted to edit the keywords for every photo I import, this could work, but would leave behind a lot of unassigned keywords that I would also have to purge. It's a lot of unnecessary work. I want Lightroom to recognize the keywords individually when importing the PNG file. Anyone know how to format the keywords in the PNG metadata so they are imported individually in Lightroom, or is this a bug in Lightroom import that should be separating keywords when imported and is not doing it correctly?

 

Thank you.

 

Lightroom Classic: v13.3.1

Windows 11 Pro 23H2

TOPICS
Windows

Views

246

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Oct 11, 2024 Oct 11, 2024

I think I figured it out. The issue was with ExifTool, not with Lightroom.

 

As explained here, if you just inject the keywords as a comma-separated list, it will be treated as a single keyword.

 

For example, this is wrong:

exiftool -keywords="one, two, three" test.jpg

If you want the values of list-type tags split into separate items, you have to use the -sep option to indicate the delimiter.

exiftool -sep ", " -keywords="one, two, three" test.jpg

 

Once I injected the keywords with the -sep option, th

...

Votes

Translate

Translate
Explorer ,
Oct 11, 2024 Oct 11, 2024

Copy link to clipboard

Copied

I thought this issue might be related to Solved: Force lightroom classic to "see" and parse importe... - Adobe Community - 14103688. But I don't think it is. They were importing CSV file of keywords with a plugin, here I'm importing a PNG file with metadata embedded using Lightroom's native importing. If I delimit the keywords with semicolons in the metadata, they are still imported as "tag4; tag5; tag6" like this:

Screenshot 2024-10-11 105549.png

It doesn't seem to matter whether they are comma delimited or semicolon delimited, they are imported as one giant keyword until edited in the keywording panel.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 11, 2024 Oct 11, 2024

Copy link to clipboard

Copied

The only thing I've run into with exiftool, pngs, and metadata is that Adobe doesn't like some of the metadata in IPTC (and maybe EXIF). Rather, it needs to go into the XMP tag group. You may have already tried this, and I admittedly have somewhat limited understanding... but, it's what I've run into. In general, I think Adobe doesn't read IPTC for PNG, but that may be too broad a statement. I think there are some threads with more detail on IPTC and EXIF for PNG specifically.

 

So, for a jpg, for example, keywords work for me comma separated in "-IPTC:Keywords=" . For a png, it only works for me if they are comma-separated in the "-XMP:Subject=" field.

 

I'm not sure what you're getting the metadata from to inject into the image files, but whenever I'm injecting metadata from an XMP file into a PNG, I just use something brute force like 

 

exiftool -tagsfromfile %d%f.xmp "-all>xmp:all" -ext png ./

 

to get everything into the XMP metadata space in the PNG rather than IPTC or EXIF. Conversely, for jpgs, I'll use the xmp2iptc and xmp2exif args files that exiftool provides. They just don't work for PNGs, though. Something to do with the history of the file format not originally defining some/all of these metadata spaces.

 

Anyway, I hope that's helpful/not just repeating things you already know!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 11, 2024 Oct 11, 2024

Copy link to clipboard

Copied

I tried injecting the keywords with exiftool into the XMP:Subject field, and it still imports as a single keyword "tag1,tag2,tag3" or "tag1, tag2, tag3" or "['tag1','tag2','tag3']" or "tag4; tag5; tag6". Nothing seems to work to get Lightroom to recognize the keywords as individual separate keywords on import. I also tried the XMP-dc:Subject field, and that didn't work either.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 11, 2024 Oct 11, 2024

Copy link to clipboard

Copied

I think I figured it out. The issue was with ExifTool, not with Lightroom.

 

As explained here, if you just inject the keywords as a comma-separated list, it will be treated as a single keyword.

 

For example, this is wrong:

exiftool -keywords="one, two, three" test.jpg

If you want the values of list-type tags split into separate items, you have to use the -sep option to indicate the delimiter.

exiftool -sep ", " -keywords="one, two, three" test.jpg

 

Once I injected the keywords with the -sep option, then when I imported the file in Lightroom, the keywords were recognized as individual separate keywords!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 12, 2024 Oct 12, 2024

Copy link to clipboard

Copied

Ah! Glad you figured it out; sorry I might have sent you down the wrong track. The power of Exiftool means that it's got tons of little important specifics like this. I haven't run into this... Looking at the XMP file I'm grabbing data the keywords are stored as separate elements in an array (I think that's the Adobe spec). Exiftool must parse this properly without help for the -tagsfromfile operation, at least using the default xmp2iptc.args file.

 

Can I ask briefly what you're grabbing metadata from in order to inject? I'm just curious about understanding different workflows folks have.

 

Thanks for sharing the solution.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 12, 2024 Oct 12, 2024

Copy link to clipboard

Copied

No worries. Thanks for your help. I think it got me on the right track, actually, taking a closer look at ExifTool.

 

I'm actually using ComfyUI to manipulate some images, generating metadata with LLMs, and then injecting that metadata back into the images. ComfyUI is a powerful tool for designing many types of workflows! I haven't quite got the ExifTool implemented in it yet, so I have to output the metadata as JSON and run that through a separate Python script. Hoping to soon get it all into Comfy.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 16, 2024 Oct 16, 2024

Copy link to clipboard

Copied

LATEST

Very interesting—thanks for sharing.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines