Hash algorythm for previews?

Status
Not open for further replies.
Joined
May 9, 2015
Messages
1,623
Location
Palo Alto, CA
Lightroom Experience
Power User
Lightroom Version
Classic
Lightroom Version
All
Operating System
  1. Windows 7
  2. Windows 8
  3. Windows 10
  4. Windows 11
  5. macOS 10.13 High Sierra
  6. macOS 10.14 Mojave
  7. macOS 10.15 Catalina
  8. macOS 11 Big Sur
  9. macOS 12 Monterey
  10. macOS 13 Ventura
This is an academic question which is pretty techie, but does anyone know what metadata is considered by LrC when it creats the folders and file names for previews?

For example, If I change the file name or capture date does this alter the folder or file name for the preview? Will the same image always get the same preview folder and file name if imported into different catalogs? or if the same original image was in different different place in the folder tree? Etc.

Thanks -- Dan
 
Joined
Jun 20, 2009
Messages
19,678
Location
Houston, TX USA
Lightroom Experience
Power User
Lightroom Version
Cloud Service
I think the process is fixed. The preview folder contains another database for indexing. You can view it using any SQLLite browser.
Imported images are assigned a unique key in LrC and this is used to index the location of the preview. This would never change no matter what metadata is changed.


Sent from my iPad using Tapatalk
 
Joined
Jun 20, 2009
Messages
19,678
Location
Houston, TX USA
Lightroom Experience
Power User
Lightroom Version
Cloud Service
Thanks Cletus. Is the "unique key" for the image in the catalog just a squential number or is it a derived number?

It has been a while since I looked at the LrC Database table but my recollection is that the image index key is sequential. Using SQLLite database manager to investigate both will reveal lots of useful information.


Sent from my iPad using Tapatalk
 
Joined
Oct 8, 2007
Messages
6,252
Location
London
Lightroom Experience
Power User
I think it's semi-derived but only upon import. So the same image is assigned different UUIDs if it's imported into different catalogues or is imported more than once (ie removed and reimported) into the same catalogue, as here:

891BA77C-C7F0-4E98-9CE5-715089770808
8EFA55FC-E063-452B-8056-701058CBDB09
 
Joined
Jan 18, 2009
Messages
2,537
Location
Fort Myers, FL
Lightroom Experience
Advanced
Lightroom Version
Classic
That's my recollection as well, underneath it'sa guid and that determines (I do not recall how) the hashing so they shouldn't move around. I figured this out a bazillion years ago (I think LR 4) as part of a validation routine, so if it becomes a real issue for you, I can probably look back through the code and figure it out again. If I can remember C#, which I do not think I've used since then.
 
Joined
Oct 8, 2007
Messages
6,252
Location
London
Lightroom Experience
Power User
This script shows the UUID:

--[[ Finds UUID of selected file SETUP INSTRUCTIONS Temporarily save this file onto your desktop and call it "YOURFILENAME.lua". Now you need to create a scripts folder: In Lightroom, choose Lightroom > Preferences (Mac OS) or Edit > Preferences (Windows). Choose the Preset tab and select Show Lightroom Presets folder. Create a folder in the Lightroom folder called Scripts. Copy the "YOURFILENAME.lua" script into the Scripts folder. Quit and reopen Lightroom. You should now see a little scripts menu to the right of the Help menu. It has a single item Title case keywords. --]] local LrTasks = import 'LrTasks' local catalog = import "LrApplication".activeCatalog() local LrDialogs = import 'LrDialogs' local LrView = import 'LrView' LrTasks.startAsyncTask( function() local photo=catalog:getTargetPhoto() varFile = photo:getRawMetadata('uuid') local f = LrView.osFactory() local c = f:row{ bind_to_object = props, f:column { f:edit_field { value = varFile, width_in_chars = 30, height_in_lines = 4 }, }, } dialogValue = LrDialogs.presentModalDialog( { title = "UUID" , contents = c, } ) end)
 

vbnut

Member
Joined
Oct 22, 2022
Messages
52
Lightroom Experience
Intermediate
Lightroom Version
Classic
That's very cool John. Is the Scripts folder and menu a supported feature? Is there documentation about it anywhere?
 
Joined
Oct 8, 2007
Messages
6,252
Location
London
Lightroom Experience
Power User
It's always worked, but there is no documentation about it, so it depends how one defines "supported". However the code is the same scripting language built into Lightroom and used by plugins.
 
Last edited:

vbnut

Member
Joined
Oct 22, 2022
Messages
52
Lightroom Experience
Intermediate
Lightroom Version
Classic
It's always worked, but there is no documentation about it, so it depends how one defines "supported". However the code is the same scripting language built into Lightroom and used by plugins.
Thanks. Can you do everything you can do in a plugin?
 
Joined
Oct 8, 2007
Messages
6,252
Location
London
Lightroom Experience
Power User
Almost, but you're limited by everything being in a single file, getting values from dialog boxes is difficult, and you can't store preferences for how the script should work. The method is best for little standalone tasks like here.
 
Status
Not open for further replies.
Top