Adobe Lightroom Classic random plug-in

A plug-in for Lightroom classic with two functions. 1. to select a random image from the whole catalogue and display it in Loupe View. And 2. to create a virtual copy of the currently viewed image and enter into Develop mode

The plug-in is licensed under GPL3 and available for you to download and modify at your own peril on Github

Below are some development notes.

? It could tag the photo with how many times it has been randomely selected.

? It could have the option to store the develop preset alongside it.

? It could add image to a “daily randoms” collection.

This will allow me to review photos in a non-chronological way.

It’s often tediuos to go through a series of images chronologically. There’s always more than one shot of a similar composition next to eachother in time, but when I’m in random mode I am looking to consider whether this particular composition is interesting, and not if that composition is better than these to similar ones.

Is the picture worth wile editing? Should it be removed/deleted? Tagges for something later?

Should there actually be two separate functions in the plug-in?

  1. Select random image
  2. Make virtual copy of selected image, tag it with random-selection, and enter develop mode?

This would more easily let me rate a random image first. There’s no point editing a photo I don’t like that day.

I found an excellen resource over on This guy seems to know what he’s talking about.

I’ve downloaded the SDK and the manual so I’ll take it from there soon.

2021-08-22 18:28

For my plug-in I make a folder called lightroom-random-image.lrdevplug-in where I keep my other code sketches.

I open it in my editor of choice, Sublime Text.

As Rob Allen writes on, every ‘Lightroom Classic plug-in has a manifest file called Info.lua. This file returns a table with metadata about the plug-in along with menu definitions and information on which files to call when an event happens.’

So I make my Info.lua manifest file:

return {
  VERSION = { 
  LrSdkVersion = 10.0,
  LrSdkMinimumVersion = 4.0,
  LrToolkitIdentifier = "",
  Lrplug-inName = "AAA Random Image",
  Lrplug-inInfoUrl = "",

Mine differs from Rob’s as I’m using the latest Lightroom Classic SDK, version 10, and I’ve changed the other content to match my intentions for this plug-in.

Before I forget, I’m making this into a git repository so I can track changes and make branches to try different things later on.

I run git init in the terminal with the project folder as the current working directory. I’ve done the inital commit and pushed to my remote.

I’ve now made a test catalogue with a small selection of images to make sure I don’t do any regrettable things to my main catalogue.

I install my plug-in via File > Plug-in manager. It seems to be running fine, but the plug-in doesn’t do much more than tell us that it exists.

I add the table, LrLibraryMenuItems to my Info.lua file to describe a menu item and which script the plug-in should execute when selected.

LrLibraryMenuItems = {
    title = "Develop random image",
    file = "develop-random-image.lua",

After this I just wanted to get on with it, and wrote the plug-in. Check out

It is released under GPL3 open source license so as long as you keep the license, do what you please with it.

API references


Retrieves the photo objects for all photos in the catalog.

This function must be called from within an asynchronous task started using LrTasks.

First supported in version 3.0 of the Lightroom SDK.

Return value

(table) An array of LrPhoto objects.

See also


catalog:setSelectedPhotos( activePhoto, otherSelectedPhotos )

Sets the photo selection programmatically.

First supported in version 3.0 of the Lightroom SDK.


  1. activePhoto

(LrPhoto) The active photo; if multiple photos are selected, this is the brightest, ‘most selected’ one.

  1. otherSelectedPhotos

(table of LrPhoto) Additional photos to select.

LrApplicationView.switchToModule( moduleName )

Switches between modules.

First supported in version 6.0 of the Lightroom SDK.


  1. moduleName

(string) The name of the module to activate, one of: ‘library’, ‘develop’, ‘map’, ‘book’, ‘slideshow’, ‘print’, ‘web’.

LUA random numbers

math.random(), math.random(0,100), math.randomseed(os.time()),

photo:addKeyword( keyword )

Adds a keyword to this photo.

Must be called from within a catalog:withWriteAccessDo or catalog:withProlongedWriteAccessDo gate.

This call can be used within the same catalog:with___WriteAccessDo call that created this keyword.

First supported in version 3.0 of the Lightroom SDK.


  1. keyword

(LrKeyword) The keyword object.


Adds or Remove photos from Target Collection.

First supported in version 7.4 of the Lightroom SDK.