INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Lightroom screwed up my keywords  (Read 1700 times)

raldo

  • Citizen of the Universe
  • *****
  • Posts: 1102
Lightroom screwed up my keywords
« on: November 06, 2017, 01:21:49 pm »

Hi,

I recently discovered that Lightroom screwed up my keywords. Luckily, I was able to recover my original scheme using MC.

But no one in the Lightroom forums are responding to my query

Does anyone here know how to configure Lightroom to honor my MC style nested keywords?

I'm only using Lightroom for facetagging so perhaps it's possible to avoid adding facetags in the Keywords section too?
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Lightroom screwed up my keywords
« Reply #1 on: November 06, 2017, 03:19:20 pm »

Oh yes. We have this just, absolutely perfect now... you're gonna have to give me a minute to find the post though....

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Lightroom screwed up my keywords
« Reply #2 on: November 06, 2017, 03:23:53 pm »

Here ya go... Well, kind of... I hope :)
I don't use Lightroom for any face tagging... should I be? How is that data saved in the file, and is it easy to get it into MC?

The answer as to how to set up Lightroom and MC for seamless transitions of nested keywords between the two is:

Lightroom:
Set it up under "Edit > Preferences > File Handling" so that "/" is treated as a heirarchy separator. (tick the box)
The make sure that your heirarchy groups are set to "Include on export", as well as "Containing keywords" (I can't remember if this is the default or not)
Finally, make sure that in your "Export" options, under "Metadata", you tick the box to "Write keywords as Lightroom heirarchy"

Then, in MC, follow the stuff below... It truly is 'set and forget', so worth the small effort setting it up.
Don't forget to let me know if I'm missing out on anything here by not using Lightroom's Face Tagging :)

For the full history, thread link is: https://yabb.jriver.com/interact/index.php/topic,109858.0.html

You can get to nested MC keywords in one pass. I've played quite a bit with it now. Results are excellent.
Yup. I have tested this both ways, and as well as the export heirarchy option being checked, all levels of the Lightroom heirarchy also need to be set to "include on export" and "Export containing keywords"

The steps below might take longer to read than to actually set up. I went a bit verbose to try and be clear for everyone who might be interested here. I also think it's important that, rather than just following a set of instructions, people understand exactly what they're asking MC to do with this setup.

Basically, all the ramble below arrives at is the addition of two library fields and a couple of 'tag on import' rules.

OK, so here we go with the how and a little bit of "why" where necessary.

1. Make two new library fields. I called them Lightroom and Lightroom to Keywords.
    1a. [Lightroom]
          When adding this, name it Lightroom, and if you are as OCD as me, set the 'Plural' to be Lightroom too, as "Lightrooms" is just not right!
         

    1b. [Lightroom to Keywords]
          This will be a calculated field. The expression will be, simply, =[Keywords]. If copying and pasting, take all the red text.
         

Make sure you can see these fields, and the keywords field, in your tag window. You will notice that if a file has existing keywords data, this is reflected in the "Lightroom to Keywords" field also. For now, do not try and edit the "Lightroom to Keywords" field. Read the "Why" section below first.

In step 2, we will set up the "Tag on import" rules, but before we do that, you must read, and understand, the following. If anything is not clear, either ask, or proceed with caution and use test files so you can see what's happening. After reading and understanding, you will be well placed to make your choice about how you want to proceed.

The "Why"
Before setting up auto import rules, we need to think about some things.

From Lightroom:
From my limited and recent testing, I have found that, when using a keyword heirarchy in Lightroom, the exported IPTC keywords (which MC reads by default) written by Lightroom are really just a jumbled mess of all the heirarchy headings, and their base keywords, in alphabetical order. I found this both distracting and disappointing. However, if, when exporting, you have the metadata option to "write keywords as Lightroom heirarchy" checked, then we get a nice "HierarchicalSubject" data block in the XMP tag that retains the keyword tree as it is displayed in Lightroom. In my limited testing, I found that sometimes, this heirarchy data was not present in XMP, but, with the export option checked, it has always been there.

MC can now read that data.

This might change in the future, but, for now, it can only read this data if the user specifically asks for it.
We can do this manually after importing the files into MC, or we can set up "Tag on import" rules to have the data read automatically at the time of importing.
We need to think about where we want this data stored, and whether or not we want it imported automatically when MC imports the files.

We could...
a. import to a field set up to exclusively receive and display this data.
b. import to MC's default 'Keywords' field.
c. both of the above.

"a" is a bit of a no-brainer, and it's why we created the "Lightroom" field earlier.

"b" needs more thought...
Auto import will not over write the contents of list type fields, it will only append to existing data. However, we can work around this limitation.
In my experience, the files exported from Lightroom using a keyword heirarchy have a complete mess of keywords (maybe I'm not using it correctly or optimally?), and having the heirarchy appended, means everything is now duplicated in the keywords field, albeit with one set of duplicates neatly organised in a tree. I want the heirarchy tree to replace the existing keywords data, in a way that MC can interpret, and so display the tree in the keywords pane, but, only if Lightroom heirarchy data exists. This is why we created the "Lightroom to Keywords" field earlier, and now, I'll explain that in more detail...

Lightroom to Keywords:
We set this field as a calculated field.
You should see that if you have existing Keywords data, it is reflected in this new field we created using the simple expression =[Keywords].
The cleverness comes from the fact that if you edit the contents of this field, your edits will propogate on to the real Keywords field. Yes, it works in reverse too, which is very handy.
Knowing this, our options are becoming clearer.
Either manually or automatically, we can bring the Lightroom data into the "Lightroom" field.
Either manually or automatically, we can bring the Lightroom data into the "Lightroom to Keywords" field, which in turn replaces any existing "Keywords" data with the "Lightroom" data.

Have a think. Something to consider here is that the assumption is made that we are dealing with files you exported personally and so are familiar with the contained metadata. If you also import images from unknown third parties, it's possible that these could potentially contain differring IPTC keywords and Lightroom heirarchy data which could, depending on your choices, cause the IPTC keywords to be replaced by the Lightroom heirarchy. Make your choice, and read on through "2"....

2. Importing the Lightroom heirarchy data into the MC library:

2a: Manually:
Manually is a pain, but also a necessary one if you have previously imported files that you know contain Lightroom heirarchy data and you want to get it out of files and into your library.
You could, of course, forgo the exclusive "Lightroom" library field if you wanted, but personally, despite forcing my data into "Keywords", I've kept the exclusive field too. It's not going to do any harm, and makes auto import a little easier to follow. When copying the expressions, be sure to catch all of the red text.

Manual import of Lightroom heirarchy:
In the tag window, click on the Lightroom field to open it for editing and enter the following expression:
=replace(Tag(XMP: HierarchicalSubject),|,\)

Lightroom uses a pipe "|" to define the heirarchy levels.
MC uses a back slash "\" to define its heirarchy levels.

The expression imports the heirarchy data, replacing the pipes with back slashes.
Go to a view that contains your image files, and add the "Lightroom" pane to it to see the Lightroom heirarchy reproduced in your MC library.

Manual replacement of existing Keywords data with Lightroom heirarchy:
Assuming you have the "Lightroom" field above:
In the tag window, click on the "Lightroom to Keywords" field to open it for editing and enter the following expression:
=[Lightroom]

If you don't want the Lightroom field at all, and want to pass directly to Keywords, enter the following expression instead:
=replace(Tag(XMP: HierarchicalSubject),|,\)

Manually appending Lightroom heirarchy to existing Keywords data:
Assuming you have the "Lightroom" field above:
In the tag window, click on the "Lightroom to Keywords" field to open it for editing and enter the following expression:
=[keywords];[Lightroom]

If you don't want the Lightroom field at all, and want to pass directly to Keywords, enter the following expression instead:
=[keywords];replace(Tag(XMP: HierarchicalSubject),|,\)

2b: The magic of "Tag on Import":
"Tag  on Import" is a wonderful MC feature. Using it, we can automate all or any of the above manual steps.

Open MC's options (press ctrl+o), type auto-import into the search field at the bottom, and click on "Configure auto-import"
Find your "Pictures" folder in the list, or add the folder you export to if it is not listed. Select it, and press the "Edit" button.

In the lower section, titled "Apply these tags (optional)", we add the rules we want. The order is very important here.

The first thing we will do is bring the data into the Lightroom field.
Click the "Add" button.
Pick "Lightroom" from the list of fields at the top.
Enter the following expression into the "Value" field:
=replace(Tag(XMP: HierarchicalSubject),|,\)
Press "OK"

Next, we want to replace any existing keywords with this Lightroom data, but, only if there is Lightroom data to replace it with. If we run this, and there is no Lightroom data, we will only succeed in deleting all existing keywords data, and we don't want to do that, so we test for it first. If there is no Lightroom data, do nothing, otherwise, replace the keywords.

Press the "Add" button again, and this time, choose "Lightroom to Keywords" from the list of fields.
Enter the following expression into the "Value" field:
if(isempty([Lightroom,0]),,replace(Tag(XMP: HierarchicalSubject),|,\))
Make sure that "Skip for files that already have a value in this field" is not checked.

OK your way all the way out, export some files from Lightroom for MC to auto-import and let me know if I missed anything.

I've read this over at least three times and I think it's complete. If it's what you want, you should now know what you're doing, and why you're doing it.
If it doesn't work, it will be because one of us missed something. Just reply here and we'll figure it out. It does appear to work, I have it working a treat here, and have tried to break it in many different ways, without success.

Replacing one set of data with another always makes people nervous. Using these steps, the only time I can see 'accidental' data loss is if importing images from a third party source that contain unexpected Lightroom heirarchy data. If I missed any other possibilities, please let me know so that I can review the instructions above.

If you would like to learn more about expressions and their possibilities, there are pages of info and examples on the wiki.

Hope that helps a bit,
-marko

raldo

  • Citizen of the Universe
  • *****
  • Posts: 1102
Re: Lightroom screwed up my keywords
« Reply #3 on: November 07, 2017, 06:47:18 am »

Yup, that should probably do it!

Thanks for your support!

H.
Logged

raldo

  • Citizen of the Universe
  • *****
  • Posts: 1102
Re: Lightroom screwed up my keywords
« Reply #4 on: January 14, 2018, 04:50:05 pm »

It seems as if the Auto Import rules are only applied when the file is initially imported by MC, right?

In my workflow I kind of go back and forth between LR and MC.

The Exif/Iptc tags are updated in MC when changed by LR.

Does anyone know if it is possible to apply rules to the Keyword tag when, another tag changes?
Logged
Pages: [1]   Go Up