Skip to main content
Inspiring
May 11, 2016
Answered

Is there a reliable way to force LR to update its preview and/or thumbnail?

  • May 11, 2016
  • 1 reply
  • 1140 views

I'm writing a plugin that, depending on user actions, will replace an already-imported JPEG with a new one. When my code that does this runs, I can see the change immediately in the OSX Finder window. Lightroom though takes a while to reflect the change. I can't detect a pattern: sometimes just a second or two, sometimes 10 seconds, sometimes I have to move the selection to another photo and then back to the one in question. I *think* that calling photo:requestJpegThumbnail after I write the new JPEG to disk has decreased the amount of time it takes but I'm not sure.

Is there a more reliable way to kick LR into reflecting the change?

Thanks,

db

This topic has been closed for replies.
Correct answer johnrellis

Two options that immediately come to mind:

1. photo:requestJpegThumbnail().  But in LR 5, it had a reputation for being unreliable; see all the posts in this thread: Lightroom SDK: photo:requestJpegThumbnail only works in Library Module. | Photoshop Family Customer Community. Haven't seen any reports for LR 6.

2.  You could try doing photo:saveMetadata() followed by photo:readMetadata () (these are undocumented: LR 5 functions, methods, and properties not in LR 4 docs ).  readMetadata() will pop up a dialog box which you can permanently dismiss by checking "Don't show again".   Note that you have to do photo:saveMetadata() first, because otherwise photo:readMetadata() could overwrite existing metadata in the catalog (e.g. keywords, captions, etc.).

1 reply

johnrellis
johnrellisCorrect answer
Legend
May 11, 2016

Two options that immediately come to mind:

1. photo:requestJpegThumbnail().  But in LR 5, it had a reputation for being unreliable; see all the posts in this thread: Lightroom SDK: photo:requestJpegThumbnail only works in Library Module. | Photoshop Family Customer Community. Haven't seen any reports for LR 6.

2.  You could try doing photo:saveMetadata() followed by photo:readMetadata () (these are undocumented: LR 5 functions, methods, and properties not in LR 4 docs ).  readMetadata() will pop up a dialog box which you can permanently dismiss by checking "Don't show again".   Note that you have to do photo:saveMetadata() first, because otherwise photo:readMetadata() could overwrite existing metadata in the catalog (e.g. keywords, captions, etc.).

johnrellis
Legend
May 11, 2016

Re photo:requestJpegThumbnail issues, also see this thread: photo:requestJpegThumbnail - Just say NO!!!

DFBurnsAuthor
Inspiring
May 12, 2016

Thanks, John.

I've read through the threads you linked to. I think I'm in the clear on that API only working in the Library module since my plugin is invoked from the Library menu. And I don't care about colorspace issues since I'm throwing the thumbnail data away (I'm just calling the API as a way to get LR to deterministically update its own display of the thumbnail).

Based on the API's doc, I thought invoking it with an unreasonably large value for width and height (e.g. 10,000) might force LR to re-render things but it doesn't seem to be true. I wonder if the message to my plugin's users is just, "give it a minute" to see changes. It's a small plugin that I expect to share freely so I can get away with that but seems a shame.

Curious about those undocumented functions: are there arguments to them? Any unofficial doc somewhere?

Thanks,

db