LightroomStatistics
Participant
LightroomStatistics
Participant
Activity
‎Mar 01, 2025
09:02 AM
1 Upvote
This works great, you put me on track again. Since I work with scrolled_view, I modified the code a little and now works also. Simply replacing f:columns(rows) by f:scrolled_view(rows) didn't work. while true do
local outerRows = {}
local rows = {}
outerRows = { spacing = f:control_spacing() }
for i = 1, nRows do
table.insert(rows, f:static_text { title = "Row " .. i })
end
table.insert(outerRows, f:scrolled_view(rows))
table.insert(outerRows, f:push_button { title = "Add row",
action = function(button)
nRows = nRows + 1
LrDialogs.stopModalWithResult(button, "refresh")
end })
local result = LrDialogs.presentModalDialog { title = "Test",
contents = f:column(outerRows) }
if result ~= "refresh" then break end
end
... View more
‎Feb 26, 2025
12:06 AM
Any news on this? @Rikk Flohr: Photography
... View more
‎Feb 26, 2025
12:06 AM
Any news on this? @Rikk Flohr: Photography
... View more
‎Feb 26, 2025
12:03 AM
I managed to display a table with rows and column using the LrDialogs.presentModalDialog. All the values from the orginal table I converted to a flat property table. propertyTable = LrBinding.makePropertyTable(context) Before adding the new row I display the table. This works fine Ofcourse variable "c" contains all groups, rows and columns. dialogValue = LrDialogs.presentModalDialog(
{
title = "My table",
contents = c,
} Having my original table and a flattened projection of it as property table, below the table rows I added a button. The button calls a function which performs the steps below: Adding a row to my original table Updating the property table with these new values Added a row to the contents in variable "c" After these steps I tried to stop and show the dialog again, however that doesn't work. LrDialogs.stopModalWithResult(dialogValue)
dialogValue = LrDialogs.presentModalDialog(
{
title = LOC "$$$/LightroomStatistics/Dialogs/Translations=Translations",
contents = c,
}
) Question How can I redraw / redisplay the modal form.
... View more
‎Oct 18, 2024
10:40 AM
I wrote a little plug-in which just should write something to the LrLogger file. Nothing gets written on my Windows 10 machine. local logFilename = LOC "LuaVersionTest"
local myLogger = import 'LrLogger'( logFilename )
myLogger:enable( "logfile" )
local logPath
function showLuaVesion()
myLogger:info( "Version:", _VERSION)
myLogger:info(_VERSION)
end
showLuaVesion() SOLVED In the new SDK the log path has changed: see We're excited to announce the MAX release of Lightroom Classic SDK 14.0! Logs interface Note: We have changed the log file location for the LrLogger interface. The timestamps are no longer appended to the folders. The updated locations are: Win: C:\Users\<user>\AppData\Local\Adobe\Lightroom\Logs\LrClassicLogs Mac: /Users/<user>/Library/Logs/Adobe/Lightroom/LrClassicLogs/
... View more
‎Jul 23, 2024
11:25 PM
Thank you again. Learning every day new things.
... View more
‎Jul 23, 2024
09:22 AM
Being somewhere in the Library module, I want a certain image to be show / active in the Develop module. The code below works as long as the image to be shown is in the grid. However, when the image is not in the active grid, then the Develop module reports "No photo selected". Even though if I go back to the grid and select "All photographs" in the left panel, the image is the selected image with the white border. The issue is that upon the start of this plug-in I want to show a specific image in the Develop module, however I have no glue which folder or collection is active at that moment. local function showInDevelopModule(photo)
catalog:setSelectedPhotos(photo, {})
local moduleName = LrApplicationView.getCurrentModuleName()
if (moduleName ~= "develop") then
LrApplicationView.switchToModule("develop")
end
end
LrFunctionContext.postAsyncTaskWithContext("test", function(context)
local message = nil
LrDialogs.attachErrorDialogToFunctionContext(context)
local photo = catalog:findPhotoByUuid("0AFA8451-6DDD-4CF6-B537-DB1E9FB53A88")
showInDevelopModule(photo)
end)
... View more
‎Jun 24, 2024
11:17 AM
What do you mean by "handling"? My question is not about handling but displaying. Lightroom does show the image, only it substitutes the transparency with white.
... View more
‎Jun 24, 2024
11:13 AM
In a PNG file that already has a transparent background, this tranparent background is always represented by a white color. So this question is NOT about making the background transparent! Question: how can I set a color with which transparency is displayed in Lightroom? I would to have the transparency be shown as black or ...
... View more
‎Jun 14, 2024
03:37 AM
Also experiencing this behavior. Any workaround to get the correct values. I need them for Temperature and Tint. Also noticed that after Resetting the settings with <Ctrl><Shift> R a lot images report no values for Temperature and Tint. Not getting the develop settings break many of the existing plug-ins! This is a core functioanlity of the SDK
... View more
‎Jun 14, 2024
02:18 AM
Lightroom version 13.3.1 and CameraRaw 16.3.1
After setting the White balance to "As shot" the photo:getDevelopSettings() doesn't return the correct develop settings for Temperature or Tint. All photos selected are RAW files.
Also there is a difference in behavior when running the script on images with or without having resetted the settings to original <Ctrl><Shift> R.
On new images the value of -999999 returned, however when you Reset the images with <Ctrl><Shift> R and run the script again, instead of the value for Temperature and Tint is nil.
Only after 1 or more seconds the correct values are returned.
First run on new images:
Now hitting the Reset settings <Ctrl><Shift> R key: Same images still selected.
Code used:
local LrApplication = import("LrApplication")
local LrDialogs = import("LrDialogs")
local LrFunctionContext = import("LrFunctionContext")
local catalog = LrApplication.activeCatalog()
local logFilename = 'WhiteBalance_01.txt'
local MyLogger = import 'LrLogger' (logFilename)
MyLogger:enable("logfile")
local inspect = require "inspect"
local function main(context)
LrDialogs.attachErrorDialogToFunctionContext(context)
local photos = catalog:getTargetPhotos()
MyLogger:info("#photos", #photos)
local devSettings = { WhiteBalance = "As shot" }
catalog:withWriteAccessDo("Apply White balance settings", function()
local preset = LrApplication.addDevelopPresetForPlugin(_PLUGIN, "WB As Shot", devSettings)
for _, photo in ipairs(photos) do
MyLogger:info(photo:getFormattedMetadata("fileName"))
photo:applyDevelopPreset(preset, _PLUGIN)
end
end)
local message = "Loop 1\n"
local nilValues = true
local counter = 1
while nilValues and (counter < 20) do
nilValues = false
for _, photo in ipairs(photos) do
local fileName = photo:getFormattedMetadata("fileName")
local developSetings = photo:getDevelopSettings()
MyLogger:info(fileName, inspect(developSetings))
-- Test for nil values
if (nilValues == false) and
(
(developSetings.Temperature == nil) or
(developSetings.Temperature == -999999) or
(developSetings.Tint == nil) or
(developSetings.Tint == -999999)
) then
nilValues = true
end
message = message ..
string.format("image: %-15s temperature: %-8s tint: %-8s\n", fileName,
developSetings.Temperature or "nil",
developSetings.Tint or "nil")
end
if (nilValues == true) then
counter = counter + 1
LrTasks.sleep(0.5)
message = message .. string.format("\n\nLoop %d -- wait for an extra %.1f seconds\n",counter, 0.5)
end
end
LrDialogs.message("LightroomStatistics", message)
end
LrFunctionContext.postAsyncTaskWithContext("", main)
... View more
‎May 20, 2024
12:13 PM
Amazing and confirm, putting the images in the same folder as their "originals" allows one to add them to the stack. How did you found out that they have to be in the same folder to be able to stack? Reading the SDK documentation I didn't found it documented, but perhaps I looked in the wrong place???
... View more
‎May 20, 2024
07:23 AM
1 Upvote
While importing photos from disk I'm struggling to stack these photos with existing photos in the Lightroom catalog. My use case: In my Lightroom catalog I have 2 images On my disk I have 2 other images, noy yet loaded into Lightroom. Their file name makes it clear which image on disk belongs to which image in the database I'm using: catalog:addPhoto( filePath, photo, 'above') What works well? The images are loaded into Lightroom. What works not? They are not stacked. Question: what am I missing? Steps to reproduce See the attached images Import the two photos without "_nbg" into Lightroom Put the other two, without "_nbg" in the file name, into some directory. Change in my sample code below my directory name with the directory name you used above. I downloaded the images from Unsplash.com local LrApplication = import "LrApplication"
local LrDialogs = import "LrDialogs"
local LrFileUtils = import "LrFileUtils"
local LrFunctionContext = import "LrFunctionContext"
local LrPathUtils = import "LrPathUtils"
local logFilename = "StackPhotos"
local myLogger = import 'LrLogger'( logFilename )
myLogger:enable( "logfile" )
local catalog = LrApplication.activeCatalog()
local function findByName(filename)
local foundPhoto = catalog:findPhotos {
searchDesc = {
criteria = "filename",
operation = "all",
value = LrPathUtils.replaceExtension(filename, "jpg"),
value2 = "",
}
}
return foundPhoto
end
local function main()
myLogger:info("Main: start")
--Import both photos WITH background in Lightroom: everyday_matters-closedEyes.jpg and Reinaldo Kevin.jpg
--Put in the directory of your chosing the 2 images without background: everyday_matters-closedEyes_nbg.png and Reinaldo Kevin_nbg.png
-- BTW _nbg stands for no background
local destinationPath = LrPathUtils.standardizePath("D:\\Temp\\Lightroom Burned Exports\\output")
myLogger:info("destinationPath", destinationPath)
-- Prepare database for adding photos
catalog:withWriteAccessDo ("Stack", function ()
-- Loop the folder with the image with no background
for filePath in LrFileUtils.directoryEntries( destinationPath ) do
-- Determine the file name of the original photo by removing the "_nbg"
local leafName = LrPathUtils.leafName(filePath:gsub("_nbg", ""))
local photo = findByName(leafName)[1]
if (photo) then
myLogger:info("Image found", leafName, photo, photo:getFormattedMetadata("fileName"))
catalog:addPhoto( filePath, photo, 'above')
else
myLogger:info("Image NOT found", leafName)
end
end
end)
LrDialogs.message("Stacking photos", "Finished stacking photos")
end
LrFunctionContext.postAsyncTaskWithContext ("Stack photos", function( context )
LrDialogs.attachErrorDialogToFunctionContext( context )
main()
end) The log file 05/20/2024 16:18:37 INFO Main: start
05/20/2024 16:18:37 INFO destinationPath D:\Temp\Lightroom Burned Exports\output
05/20/2024 16:18:37 INFO Image found everyday_matters.png LrPhoto( id "126" ) everyday_matters.jpg
05/20/2024 16:18:39 INFO Image found Reinaldo Kevin.png LrPhoto( id "121" ) Reinaldo Kevin.jpg
... View more
‎Apr 29, 2024
09:01 AM
I already figured out the scanning of the xmp files, however I missed the "Preferences > Presets > Store Presets With This Catalog" consequences. Thank you!
... View more
‎Apr 26, 2024
12:29 AM
We need to be able to identify whether a specific creative profile has been imported into LrC. I know that we can see presets, but are we able to see creative profiles in the same way? Does the SDK provide this option? The only option I can think of is looping all files below the CameraRaw directory looking for a <profile name>.xmp file.
... View more
‎Oct 07, 2023
08:44 AM
1 Upvote
A little bit late ... As the others have stated it is not possible to query a database. However it is very easy with Python (FastAPI) or Java (SpringBoot) for example to create a web service which queries the database. From Lightroom you could call this web service with the LrHTTP GET or POST SDK modules and parse the reponse JSON. There is a good implementation in Lua for parsing to and from JSON and lua tables.
... View more
‎Oct 07, 2023
08:35 AM
1 Upvote
For uploading thumbnails from Lightroom to a cloud service, I need to send images with exact dimensions, atleast one dimension should have the exact size. I experimented with photo:requestJpegThumbnail( 400, 400 ... but, as the documentation states, the resultant thumbnail might be bigger. So that doesn't work for me. For now I'm using the ExportService and that works, but this seems like overkill to me. Question: is there a different method to generate thumbnails in Lightroom using the SDK with the exact size? It could be that more than a thousand images need to be uploaded.
... View more
‎Jul 18, 2023
11:05 AM
Thanks John, again, you hit the nail. For those looking at this message after me, this solutions works also for modules local function scriptRequire (module)
local LrFileUtils = import "LrFileUtils"
local LrPathUtils = import "LrPathUtils"
local appData = LrPathUtils.getStandardFilePath ("appData")
local scripts = LrPathUtils.child (appData, "Scripts")
local path = LrPathUtils.child (scripts, module .. ".lua")
local contents = LrFileUtils.readFile (path)
return loadstring (contents)()
end
local myModule = scriptRequire ("script-require-1")
local result = myModule.hello()
import "LrDialogs".message (result) and local myModule = {}
function myModule.hello()
return "Hello world"
end
return myModule
... View more
‎Jul 17, 2023
11:50 AM
When I try to load a different module from a lua script in de script directory, I get an error. I created a module from the crop-corners.lua script which John Ellis described on this forum. That module I would like to insert = require I tried all kind of variations to what works normally inside a plug-in, but with no luck. local myModule = require 'myModule' To be clear, the script is NOT a plug-in, but a lua file in the script directory. From this script I want to load a different module (lua script) in the same script directory.
... View more
‎Mar 17, 2023
09:34 AM
Is there a way to "Auto straighten" from a plug-in using the Lr SDK?
... View more
‎Jan 23, 2023
08:26 AM
By default my LrDialogs.presentModalDialog actionVerb is set to Done. However, when a certain value is entered in the taskDescription edit_field, it should change to a different value. Question: is it possible to change the actionVerb of a presentModalDialog to a different text based on the user input? I tried the following with an addObserver and the static_field is changed correctly when the user enters "Change", however the button text remains the same. local LrBinding = import "LrBinding"
local LrDialogs = import "LrDialogs"
local LrFunctionContext = import "LrFunctionContext"
local LrView = import "LrView"
local bind = LrView.bind
LrFunctionContext.callWithContext ("test", function (context)
local f = LrView.osFactory ()
local p = LrBinding.makePropertyTable (context)
p.taskDescription = ""
p.buttonTitle = "Ok"
p:addObserver( 'taskDescription', function( p, key, newValue )
if (newValue == "Change") then
p.buttonTitle = "New name"
end
end )
local res = LrDialogs.presentModalDialog {
title = "Test",
contents = f:row {
bind_to_object = p,
f:edit_field {alignment = 'left',
place_horizontal = 0,
width_in_chars = 20, immediate = true,
value = bind "taskDescription"
},
f:static_text {alignment = 'left',
place_horizontal = 0,
width_in_chars = 20,
title = bind "buttonTitle"
},
actionBinding = {
enabled = LrBinding.keyIsNot ("taskDescription", "", p)
},
actionVerb = bind "buttonTitle"
}
}
end)
... View more
‎Jan 21, 2023
12:06 AM
Awesome John I works, you nailed it again!
... View more
‎Jan 20, 2023
04:17 AM
What I want is to have the dialog Ok button only be enabled when a edit_field is not empty. In the post https://community.adobe.com/t5/lightroom-classic-discussions/modale-validation/m-p/9351740 John Ellis gives the following example which I extended by one edit_field. Setting the check on the popup_menu works, setting it on the popup_menu works not. 2 questions: What am I missing that this doesn't work for the edit_field What is the most easy way to disable the Ok button if an edit_field is empty. If possible I want to stay away from using addObserver local LrBinding = import "LrBinding"
local LrDialogs = import "LrDialogs"
local LrFunctionContext = import "LrFunctionContext"
local LrView = import "LrView"
local bind = LrView.bind
LrFunctionContext.callWithContext ("test", function (context)
local f = LrView.osFactory ()
local p = LrBinding.makePropertyTable (context)
local res = LrDialogs.presentModalDialog {title = "Test",
contents = f:row {
bind_to_object = p,
f:popup_menu {value = bind ("selection"),
items = {{title = "A", value = "A"}, {title = "B", value = "B"}}
},
f:edit_field {
alignment = 'left',
place_horizontal = 0,
value = bind( 'taskDescription' ),
width_in_chars = 20,
},
},
-- actionBinding = {enabled = LrBinding.keyIsNotNil ("selection", p)}}
actionBinding = {enabled = LrBinding.keyIsNotNil "taskDescription", p)}}
end) .
... View more
‎Dec 31, 2022
12:59 AM
Minor update. When adding the code above to a second menu option in the same plug-in, it turns out that adding context:addCleanupHandler triggers setting running to false. However when I first check running then everything works fine. local function main (context)
if running then return end
context:addCleanupHandler (function ()
running = false
end)
running = true
...
end
LrFunctionContext.callWithContext ("", main)
... View more
‎Dec 29, 2022
09:50 AM
1 Upvote
I created a plug-in which might take some time to finish dependant upon the number of photos selected. Question: how I can prevent that the plug-in is started anew while it is already running? Currently I update the LRPrefs at the start and again when the plugin finishes. However I don't like this solution, because sometimes, due to an error, the plugin quits and then the 2nd LrPrefs call is never made and the plugin prevents to start. Ofcourse that can be reset, but I would like to know if there is a better way that the plugin itself can detect that it is already running.
... View more
‎Nov 11, 2022
10:22 AM
This works, thanks again
... View more
‎Nov 09, 2022
01:05 PM
In the plugin manager I want to show information retrieved via an API. I get the error "We can only wait from within a task". Normally for the "normal" plug-in functionality I start the main function from within LrFunctionContext.postAsyncTaskWithContext ("Photo settings", function( context )
LrDialogs.attachErrorDialogToFunctionContext( context )
main()
end) but how can I get the info from the internet API in the plug-in manager. local LrHttp = import "LrHttp"
local JSON = require 'JSON'
local function getIpAddress()
local headers = {
{ field = "Accept", value = "application/json" },
{ field = "Content-Type", value = "application/json" },
{ field = "User-Agent", value = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134" },
{ field = "X-Requested-With", value = "XMLHttpRequest" },
}
local responseBody, hdrs = LrHttp.get("https://ipinfo.io/161.185.160.93/geo", headers )
local responseTable = JSON:decode(responseBody)
return responseTable.ip
end
local function sectionsForTopOfDialog( f, _ )
local ipAddress = getIpAddress()
return {
-- Section for the top of the dialog.
{
title = LOC "$$$/CustomMetadata/PluginManager=Custom Metadata Sample",
f:row {
f:static_text {
title = "IP address",
},
f:static_text {
title = ipAddress,
fill_horizontal = 1,
},
},
},
}
end
return{
sectionsForTopOfDialog = sectionsForTopOfDialog,
}
... View more
‎Aug 25, 2022
11:46 AM
Is it possible to create option menu options? Has anyone tried this? I tried to include a require of a module with a function, but I get the error: info.lua:1 attempt to call global 'require' (nil value)
... View more
‎Jul 19, 2022
11:19 AM
When using the LrExportSession module all the exported images get a history step name like "Export - Hard drive (date time)" local exportSession = LrExportSession
{
exportSettings = exportSettings,
photosToExport = photos
} Question: is there a way to change the history step to something custom?
... View more
‎Jul 19, 2022
10:25 AM
The best solution I could find is: for i, rendition in exportSession:renditions(renditionParams) do loop local err_code = LrTasks.execute( quotedCommand ) end
... View more