Skip to main content
27shutterclicks
Inspiring
September 28, 2022
Question

SDK: Getting the position of the Loupe Overlay > Layout Image

  • September 28, 2022
  • 1 reply
  • 317 views

#SDK - I have some ideas on expanding the use of the Layout Image overlay (View > Loupe Overlay > Layout Image), so I've been digging for how to get its properties.

 

So far, all I've found is that it saves the placement, opacity and filename of the layout image in the main preferences file in /AppData/Roaming/Adobe/Lightroom/Preferences:

 

    LayoutOverlay_bottom = 0,
	LayoutOverlay_left = 0,
	LayoutOverlay_margin_bottom = 0.29698442820092,
	LayoutOverlay_margin_left = 0.075870798890978,
	LayoutOverlay_margin_right = 0.069698054660461,
	LayoutOverlay_margin_top = -0.17659156262512,
	LayoutOverlay_matte_opacity = 0,
	LayoutOverlay_mruLayoutImages = "paths = {\...(edited)}\",
	LayoutOverlay_opacity = 0.47666666666667,
	LayoutOverlay_place_horizontal = 0,
	LayoutOverlay_place_vertical = 0,
	LayoutOverlay_right = 0,
	LayoutOverlay_scale = 1,
	LayoutOverlay_top = 0,
...
    LoupeOverlay_grid_size = 49,
	LoupeOverlay_guide_X = 0.5,
	LoupeOverlay_guide_Y = 0.5,
	LoupeOverlay_imagePath = "...(edited)...",
	LoupeOverlay_show_grid = false,
	LoupeOverlay_show_guides = true,
	LoupeOverlay_show_image = true,

 

Sadly, all these preferences are not available as part of the API's LrPrefs namespace. I found a way to read this file manually and access these keys and their values, with one caveat: it seems that this preferences file gets written to disk 30 seconds after the last change to it.

 

This means that the actual placement/properties of the layout image is not available until 30 seconds after the user modifies it. 

 

I've tried to find if there are any other ways or temp files that can be used to get more of a real-time state of the layout image, but so far no luck. I think Lightroom simply stores the real-time values in memory and writes them to disk after the 30 seconds delay.

 

Does anyone have further insight into this? Maybe @johnrellis ?

 

Thanks.

This topic has been closed for replies.

1 reply

johnrellis
Legend
September 28, 2022

I think reading the preferences is your only option.  As you've observed, the preferences stores a lot more than explicit settings made by the user in the Preferences dialog -- it stores most of the UI state.  

 

You might check out my post about a detailed examination of preferences policy:

https://community.adobe.com/t5/lightroom-classic-ideas/p-avoid-preferences-quot-corruption-quot-by-changing-when-the-preferences-file-gets-written/idi-p/12981414 

 

 

27shutterclicks
Inspiring
September 28, 2022

Thanks, John, very helpful post on the preferences file. Let's see if Adobe's going to do anything about it. 

 

Meanwhile, I'll have to think of a way to explain to the user and make them wait 30 secs until the updated properties are available.

johnrellis
Legend
September 28, 2022

"Let's see if Adobe's going to do anything about it. "

 

Well, my post is a well-informed hypothesis, but since I don't have access to LR internals (except what we can see via the SDK and externally in the file system), I don't know if the hypothesis is correct. Several years ago at least there was a public push on the forum by the then-engineering team to try to fix the corrupt-preferences problem, but then all went radio silent.