- Lua 97.2%
- Shell 2.8%
Adds an "If a photo exists" Export setting. On the Export path the plugin pre-flights the render's filenames against the destination gallery (POST .../images/check-duplicates) and, for real collisions only, sends the chosen duplicate_actions to the upload: keep_both (server renames _v2, the default), replace (overwrite in place, keeping the image id / client picks / gallery cover), or skip. Non-colliding files are never renamed or skipped. Publish keeps its id-based dedup and ignores the setting. Requires ContactSheet >= v1.6.6; an older server 404s the pre-flight and the plugin falls back to the previous append behaviour (fail-safe — an export never breaks). JSON.encode is now array/nesting-capable for the filenames body. Verified: JSON unit tests; HTTP contract against a live backend via PAT; and the real CSApi paths executed inside Lightroom Classic (createGallery + checkDuplicates + keep_both/replace uploads) producing the expected server state. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013XYS5s5QRxnTbr5HTn3ugc |
||
|---|---|---|
| ContactSheet.lrplugin | ||
| .gitignore | ||
| DESIGN-import-picks.md | ||
| install.sh | ||
| LICENSE | ||
| README.md | ||
| release.sh | ||
ContactSheet — Lightroom Classic export plugin
A Lightroom Classic plugin that exports selected photos straight into a
ContactSheet gallery. Lightroom
renders each photo per your export settings; the plugin uploads the finished files
to your ContactSheet instance using a personal access token (cs_pat_…) — no
password is shared.
MIT-licensed and independent of ContactSheet itself: it only speaks ContactSheet's public REST API over HTTPS. Pure Lua (the Lightroom SDK), so it runs on macOS and Windows from the same code and needs no compiler or notarisation.
Lightroom Classic only. Lightroom (cloud / "CC") has no local plugin SDK of this kind.
Features
- Export to a gallery from File > Export, with the full Lightroom render pipeline (format, size, sharpening, metadata, watermark) under your control.
- Publish Service — ContactSheet appears under Publish Services too. Each published collection maps to a gallery (auto-created, named after the collection); re-publishing an edited photo replaces it on the server (no duplicates), and removing photos from the collection deletes them from ContactSheet.
- Choose or create a gallery (for Export) — Choose or create gallery… opens a searchable picker: gallery names in a hierarchy (sub-galleries indented), a live name filter, and create a gallery or sub-gallery (name + Showcase/ Review mode) without leaving the dialog.
- Duplicate handling on re-export (for Export) — an If a photo exists setting:
Keep both (uploads the new render renamed
_v2, the default), Replace (overwrites the existing photo in place — its client picks, comments and gallery cover are kept), or Skip. Matches on filename in the destination gallery. Requires a ContactSheet instance ≥ v1.6.6; older servers just append as before. (Publish has its own duplicate-free re-publish and ignores this setting.) - Read client picks back — pull each photo's ContactSheet color flag → Lightroom
color label and star rating → Lightroom rating. Non-destructive: only sets where
ContactSheet has a value. Needs a token with the
images:readscope. Two commands under Library > Plug-in Extras:- Sync client picks from ContactSheet — for published collections; matched exactly by the remote id stored at publish time.
- Import client picks from a gallery… — for galleries made with the plain
Export provider (or on the web), which have no publish mapping. Pick any gallery
and it matches its picks to your current Library selection by filename (basename,
ignoring the extension, so
IMG_1234.jpg↔IMG_1234.CR3). Ambiguous names — the same basename on more than one photo, on either side — are skipped, never guessed.
- Upload progress, cancellation, and a clear summary of any photos that failed.
Requirements
- Lightroom Classic 6 / CC or later (uses the standard Export SDK).
- A ContactSheet instance reachable over HTTPS (or
http://127.0.0.1:…for local testing). - No build tools — the plugin is plain Lua.
Install
- Download
ContactSheet-<version>.lrplugin.zipfrom the latest release and unzip it, or clone this repo.- On macOS, a downloaded plugin may be quarantined; if Lightroom won't load it, run
xattr -dr com.apple.quarantine ContactSheet.lrplugin.
- On macOS, a downloaded plugin may be quarantined; if Lightroom won't load it, run
- In Lightroom: File > Plug-in Manager > Add and point it at the
ContactSheet.lrpluginfolder — or run./install.sh(copies it into Lightroom's auto-loadModulesfolder) and restart Lightroom.
Maintainers: ./release.sh packages the current Info.lua version into
dist/ContactSheet-<version>.lrplugin.zip.
Setup
- In ContactSheet (admin): Settings → API tokens → Create token. Grant
galleries:read,galleries:writeandimages:write(addimages:readif you want to read client picks back into Lightroom — both readback commands needgalleries:read+images:read), and copy thecs_pat_…secret (shown once). - In Lightroom: select photos → File > Export → choose ContactSheet as the
Export To target (top of the dialog). In the ContactSheet panel:
- Instance URL — e.g.
https://photos.example.com. - API token — paste the
cs_pat_…. - Click Choose or create gallery… — search/pick an existing gallery, or create a new gallery or sub-gallery. The chosen Destination is shown in the panel.
- Instance URL — e.g.
- Set the usual File Settings / Image Sizing below, then Export.
You can save this as an Export preset, or add it as a Publish Service for repeat use.
Reading client picks back into Lightroom
Once your client has flagged/rated photos in ContactSheet, pull those picks back into
your catalog: color flag → Lightroom color label, star rating → Lightroom
rating. It's non-destructive — a photo is only touched where the client set a value,
and your own labels/ratings are never cleared. Your token needs galleries:read +
images:read (the Read client picks permission).
There are two commands under Library → Plug-in Extras — pick the one that matches how the gallery was made:
-
Sync client picks from ContactSheet — for galleries you published via the Publish Service. Photos are matched exactly by the ID stored when they were published. Just run it; it syncs every published collection.
-
Import client picks from a gallery… — for galleries made with plain Export (or created on the web), which have no publish mapping. Steps:
- In the Library grid, select the photos you want to update (or select all).
- Run Library → Plug-in Extras → Import client picks from a gallery…
- First time only: enter your Instance URL and token.
- Pick the gallery in the list and click Select.
- A summary shows how many photos were updated.
Matching is by filename, ignoring the extension and case (so
IMG_1234.jpgin ContactSheet matchesIMG_1234.CR3in your catalog). Accents and umlauts are matched robustly too — names that differ only by Unicode form (macOS storesGrüßedecomposed, ContactSheet composed) still match. If the same base filename appears on more than one photo — on either side — it's skipped rather than guessed, so give matching photos unique names for a clean result.
How it works
Lightroom renders the selected photos to temporary files using your export settings,
then calls the plugin's processRenderedPhotos, which multipart-POSTs each file to
/api/galleries/{id}/images with an Authorization: Bearer cs_pat_… header. Gallery
listing uses GET /api/galleries; creation uses POST /api/galleries. The temp
renders are deleted after upload. Settings persist with the Lightroom export preset /
publish service.
Project layout
| Path | Purpose |
|---|---|
ContactSheet.lrplugin/Info.lua |
Plugin manifest (registers the Export Service Provider) |
ContactSheet.lrplugin/CSExportServiceProvider.lua |
Provider: render settings + processRenderedPhotos (export + publish upload loop) |
ContactSheet.lrplugin/CSPublishSupport.lua |
Publish Service callbacks (collection↔gallery, republish, delete) |
ContactSheet.lrplugin/CSSyncPicks.lua |
Plug-in Extras action: read published-collection picks into the catalog (matched by remote id) |
ContactSheet.lrplugin/CSImportPicks.lua |
Plug-in Extras action: import any gallery's picks onto the current selection (matched by filename) |
ContactSheet.lrplugin/CSApplyPicks.lua |
Shared flag/rating apply rule + filename match key (used by both readback commands) |
ContactSheet.lrplugin/CSDialogSections.lua |
The ContactSheet settings panel (URL, token, destination + open picker) |
ContactSheet.lrplugin/CSGalleryBrowser.lua |
Searchable picker/creator — filtered name list, create gallery/sub-gallery |
ContactSheet.lrplugin/CSApi.lua |
REST client (list / create galleries, upload, delete image) |
ContactSheet.lrplugin/JSON.lua |
Minimal JSON encode/decode (the SDK ships none) |
install.sh |
Copy into Lightroom's auto-load Modules folder |
release.sh |
Package ContactSheet.lrplugin into dist/ContactSheet-<version>.lrplugin.zip |
Roadmap
- Publish polish — map a published collection to an existing gallery (not only auto-create), and a per-collection settings panel.
- Per-gallery sub-gallery targeting; multiple destinations at once.
- Windows test (same Lua, untested there).
License
MIT © 2026 Niels Franke. Not affiliated with Adobe.